create table test ( id int, times datetime ) go CREATE DEFAULT DF_COL AS '1999-09-09'; GO sp_bindefault DF_COL, 'test.times';
if object_id('test') is not null drop table test go create table test ( id int, times datetime default('1999-9-9') ) go insert test(id) select 1select * from test (1 行受影响) id times ----------- ----------------------- 1 1999-09-09 00:00:00.000(1 行受影响)
你好。我在插入数据库的时候,insert into student values(4,'king',3),该语句提示::::插入错误: 列名或所提供值的数目与表定义不匹配。这个是什么原因??
(
id int,
times datetime
)
go
CREATE DEFAULT DF_COL AS '1999-09-09';
GO
sp_bindefault DF_COL, 'test.times';
drop table test
go
create table test
(
id int,
times datetime default('1999-9-9')
)
go insert test(id)
select 1select * from test
(1 行受影响)
id times
----------- -----------------------
1 1999-09-09 00:00:00.000(1 行受影响)