4 个解决方案
#1
CREATE TABLE [dbo].[wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL ,
[isgbk] [tinyint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wbzxck] ADD
CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22) FOR [cipin],
CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0) FOR [isgbk],
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
GO
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL ,
[isgbk] [tinyint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wbzxck] ADD
CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22) FOR [cipin],
CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0) FOR [isgbk],
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
GO
#2
--或者
CREATE TABLE [wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22),
[isgbk] [tinyint] NULL CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0),
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22),
[isgbk] [tinyint] NULL CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0),
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
) ON [PRIMARY]
GO
#3
Create Table TableName
( ColName Int Default(12),
ColName2 Int
)
( ColName Int Default(12),
ColName2 Int
)
#4
create table MyTable
(
i_id int not null default(0),
i_no char(1) not null default('T'),
i_date datetime not null default(getdate())
)
(
i_id int not null default(0),
i_no char(1) not null default('T'),
i_date datetime not null default(getdate())
)
#1
CREATE TABLE [dbo].[wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL ,
[isgbk] [tinyint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wbzxck] ADD
CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22) FOR [cipin],
CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0) FOR [isgbk],
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
GO
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL ,
[isgbk] [tinyint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wbzxck] ADD
CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22) FOR [cipin],
CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0) FOR [isgbk],
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
GO
#2
--或者
CREATE TABLE [wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22),
[isgbk] [tinyint] NULL CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0),
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [wbzxck] (
[ci] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[bm] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[cipin] [int] NULL CONSTRAINT [DF_wbzxck_cipin] DEFAULT (22),
[isgbk] [tinyint] NULL CONSTRAINT [DF_wbzxck_isgbk] DEFAULT (0),
CONSTRAINT [PK_lwck] PRIMARY KEY NONCLUSTERED
(
[ci]
) ON [PRIMARY]
) ON [PRIMARY]
GO
#3
Create Table TableName
( ColName Int Default(12),
ColName2 Int
)
( ColName Int Default(12),
ColName2 Int
)
#4
create table MyTable
(
i_id int not null default(0),
i_no char(1) not null default('T'),
i_date datetime not null default(getdate())
)
(
i_id int not null default(0),
i_no char(1) not null default('T'),
i_date datetime not null default(getdate())
)