创建表对象模板
USE DBName
GO
/*================================================================================
Server: ?
DataBase: ?
Author: ?
Date: ??/??/????
Content: ?
================================================================================*/
--Money类型是不允许使用的,请用Decimal(12,2)代替
CREATE Table [dbo].[Table]
(
ID INT IDENTITY(1,1) NOT NULL,
Field1 NCHAR(10) NOT NULL,
Field2 NCHAR(3) NOT NULL CONSTRAINT DF_Table_Field2 DEFAULT ('Jeriffe'),
Field3 INT NOT NULL CONSTRAINT DF_Table_Field3 DEFAULT (119),
Field4 INT NOT NULL,
CONSTRAINT PK_Table_ID PRIMARY KEY CLUSTERED
(
TransactionNumber ASC
)
) ON [PRIMARY]
GO
--创建普通索引
CREATE NONCLUSTERED INDEX IX_Table_Field1 ON dbo.Table
(
[Field1]
)WITH (FILLFACTOR = 90)
Go
--创建唯一索引
CREATE UNIQUE NONCLUSTERED INDEX [IXU_Table_Field1_Field2] ON dbo.[Table]
(
[Field1],[Field2]
)WITH (FILLFACTOR=80) ON [PRIMARY]
GO
/*================================================================================
Server: ?
DataBase: ?
Author: ?
Date: ??/??/????
Content: ?
================================================================================*/
--Money类型是不允许使用的,请用Decimal(12,2)代替
CREATE Table [dbo].[Table]
(
ID INT IDENTITY(1,1) NOT NULL,
Field1 NCHAR(10) NOT NULL,
Field2 NCHAR(3) NOT NULL CONSTRAINT DF_Table_Field2 DEFAULT ('Jeriffe'),
Field3 INT NOT NULL CONSTRAINT DF_Table_Field3 DEFAULT (119),
Field4 INT NOT NULL,
CONSTRAINT PK_Table_ID PRIMARY KEY CLUSTERED
(
TransactionNumber ASC
)
) ON [PRIMARY]
GO
--创建普通索引
CREATE NONCLUSTERED INDEX IX_Table_Field1 ON dbo.Table
(
[Field1]
)WITH (FILLFACTOR = 90)
Go
--创建唯一索引
CREATE UNIQUE NONCLUSTERED INDEX [IXU_Table_Field1_Field2] ON dbo.[Table]
(
[Field1],[Field2]
)WITH (FILLFACTOR=80) ON [PRIMARY]