You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/word/新协航_设计文档/数据库建表文档/1.0/receipt.sql

53 lines
1.5 KiB
MySQL

3 years ago
/****** Object: Table [dbo].[Import_receipt] Script Date: 09/13/2013 09:17:04 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Import_receipt]') AND type in (N'U'))
DROP TABLE [dbo].[Import_receipt]
GO
/****** Object: Table [dbo].[Import_receipt] Script Date: 09/13/2013 09:17:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Import_receipt](
[id] [int] IDENTITY(1,1) NOT NULL,
[ContractNo] [varchar](50) not NULL,
[Receiptid] [tinyint] default 0,
[ReceiptNo] [varchar](50) NULL,
[state] [tinyint] default 0,
[Send_date] [datetime] NULL,
[receive_date] [datetime] NULL,
[repeat_date] [datetime] NULL,
[trancer] [varchar](50) NULL,
[trancNo] [varchar](50) NULL,
[remark] [varchar](150) NULL,
CONSTRAINT [PK_Import_receipt] 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]
GO
SET ANSI_PADDING OFF
GO
insert into [Import_receipt] ([ContractNo],[Receiptid],[ReceiptNo])
values('AA03',1,'A0000001')
insert into [Import_receipt] ([ContractNo],[Receiptid],[ReceiptNo])
values('AA03',2,'A0000002')
select * from import_receipt
SELECT [id],[ContractNo],[Receiptid],enumvaluename as receiptname,
[ReceiptNo],[state]
,[Send_date],[receive_date],[repeat_date]
,[trancer],[trancNo],[remark]
FROM Import_receipt
left join tsysenumvalue on enumtypeid=2 and tsysenumvalue.enumvalueid=Receiptid
where [ContractNo]='AA03'