CSDN博客

img YangYuWeb

改变表已添加约束、外键

发表于2004/11/2 17:25:00  948人阅读

ALTER TABLE [dbo].[employee] WITH NOCHECK ADD
 CONSTRAINT [DF__employee__job_id__1B0907CE] DEFAULT (1) FOR [job_id],
 CONSTRAINT [DF__employee__job_lv__1CF15040] DEFAULT (10) FOR [job_lvl],
 CONSTRAINT [DF__employee__pub_id__1DE57479] DEFAULT ('9952') FOR [pub_id],
 CONSTRAINT [DF__employee__hire_d__1FCDBCEB] DEFAULT (getdate()) FOR [hire_date],
 CONSTRAINT [PK_emp_id] PRIMARY KEY  NONCLUSTERED
 (
  [emp_id]
 )  ON [PRIMARY] ,
 CONSTRAINT [CK_emp_id] CHECK ([emp_id] like '[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][FM]' or [emp_id] like '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][FM]')
GO

ALTER TABLE [dbo].[employee] ADD
  FOREIGN KEY
 (
  [job_id]
 ) REFERENCES [dbo].[jobs] (
  [job_id]
 ),
  FOREIGN KEY
 (
  [pub_id]
 ) REFERENCES [dbo].[publishers] (
  [pub_id]
 )
GO

阅读全文
0 0

相关文章推荐

img
取 消
img