关于添加默认值的问题!
假设有个表中有个字段的数据类型是这样的Numeric(12,2),在建时忘给它设默认值了,现在表开始用了,里面有数据了,我想用SQL语言将默认值给添上去,请问怎么写?
2007-01-18 09:53
2007-01-18 17:33
2007-01-19 08:35

2007-01-19 10:23
declare @t table
(
id int primary key,
c2 decimal(18,2)
)
declare @i int
set @i=1
while (@i<5)
begin
insert into @t(id) values(@i)
set @i=@i+1
end
insert into @t values(5,8.88)
select * from @t
update @t set c2=9.99 where c2 is null
select * from @t

2007-01-19 16:25
[此贴子已经被作者于2007-1-24 9:27:18编辑过]

2007-01-24 09:26
2007-01-24 09:51
2007-01-24 11:34
2007-01-24 13:00
2007-01-25 08:43