如何为现有的列设置默认值

20 浏览
0 Comments

如何为现有的列设置默认值

这在SQL Server 2008中不起作用:

ALTER TABLE Employee ALTER COLUMN CityBorn SET DEFAULT 'SANDNES'

错误信息为:

关键字\'SET\'附近语法不正确。

我做错了什么?

admin 更改状态以发布 2023年5月21日
0
0 Comments

这在SQL Server中是有效的:

ALTER TABLE Employee ADD CONSTRAINT DF_SomeName DEFAULT N'SANDNES' FOR CityBorn;

0