创建表和创建表约束 程序员

create table [dbo].[Products](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ProductName] [nvarchar](max) NULL,
    [Category] [int] NOT NULL,
    [ProductsDetail] [int] NOT NULL,
 constraint [PK__Products__3214EC0753DB1A8D] primary key clustered
(
    Id asc
)with (pad_index = off, statistics_norecompute=off, ignore_dup_key=off,allow_row_locks=on,allow_page_locks =on) on primary
) on primary textimage_on primary
go


更新表创建约束

alter table [dbo].[Products]  with check add constraint [FK_Products_{ProductsDetails] foreign key([ProductsDetail])
references [dbo].[ProductsDetails] ([PId])
两年了,依然没有前进,是自己找不到方向,也是一份刻骨的考验。只好重新出发,为那个目标继续前进!
原文地址:https://www.cnblogs.com/huangjing/p/3027931.html