默认值对象的创建与使用
(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 default DF_GRADE AS 0
go
CREATE TABLE grade (DailyGrade INT,PracticeGrade INT,TestGrade INT)
go
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'
go
DROP DEFAULT df_grade