USE tempdb
GO
SET NOCOUNT ON
--======================================
--创建测试环境
--======================================
RAISERROR('创建测试环境', 10, 1) WITH NOWAIT
-- Table A
CREATE TABLE [dbo].A(
[TranNumber] [int] IDENTITY(1, 1) NOT NULL,
[INVNO] [char](8) NOT NULL,
[ITEM] [char](15) NULL DEFAULT (''),
PRIMARY KEY([TranNumber])
)
CREATE INDEX [indexONinvno] ON [dbo].A([INVNO])
CREATE INDEX [indexOnitem] ON [dbo].A ([ITEM])
CREATE INDEX [indexONiteminnvo] ON [dbo].A([INVNO], [ITEM])
GO
-- Table B
CREATE TABLE [dbo].B(
[ItemNumber] [char](15) NOT NULL DEFAULT (''),
[CompanyCode] [char] (4) NOT NULL,
[OwnerCompanyCode] [char](4) NULL,
PRIMARY KEY([ItemNumber], [CompanyCode])
)
CREATE INDEX [ItemNumber] ON [dbo].B([ItemNumber])
CREATE INDEX [CompanyCode] ON [dbo].B([CompanyCode])
CREATE INDEX [OwnerCompanyCode] ON [dbo].B([OwnerCompanyCode])
GO
文章来源于领测软件测试网 https://www.ltesting.net/