默认值对象的创建与使用
(1)使用T-SQL语句创建名为DF_GRADE的默认值对象,值为0。
(2)使用企业管理器将DF_GRADE绑定到成绩表Grade中的DailyGrade、PracticeGrade和TestGrade字段上。
(3)使用sp_unbindefault存储过程将DF_GRADE从DailyGrade、PracticeGrade和TestGrade字段上解除。
(4)删除DF_GRADE默认值对象。以上要怎么实现?谢谢
(1)使用T-SQL语句创建名为DF_GRADE的默认值对象,值为0。
(2)使用企业管理器将DF_GRADE绑定到成绩表Grade中的DailyGrade、PracticeGrade和TestGrade字段上。
(3)使用sp_unbindefault存储过程将DF_GRADE从DailyGrade、PracticeGrade和TestGrade字段上解除。
(4)删除DF_GRADE默认值对象。以上要怎么实现?谢谢
CREATE TABLE grade (DailyGrade INT,PracticeGrade INT,TestGrade INT)
exec sp_bindefault 'DF_GRADE','grade.DailyGrade'
exec sp_bindefault 'DF_GRADE','grade.PracticeGrade'
exec sp_bindefault 'DF_GRADE','grade.TestGrade'exec sp_unbindefault 'grade.DailyGrade'
exec sp_unbindefault 'grade.PracticeGrade'
exec sp_unbindefault 'grade.TestGrade'
DROP DEFAULT df_grade
未来的 Microsoft SQL Server 版本中将删除 CREATE DEFAULT。请避免在新的开发工作中使用 CREATE DEFAULT,并计划修改当前使用它的应用程序。而应使用通过使用 ALTER TABLE 或 CREATE TABLE 的 DEFAULT 关键字所创建的默认值定义。有关详细信息,请参阅创建和修改 DEFAULT 定义。
add constraint DF_GRADE default '0' for dailygrade
用上面的只会设置一个默认值,不知道能不能同时for dailygrade PracticeGrade和TestGrade