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/Finance_Out.sql

80 lines
1.8 KiB
Transact-SQL

/****** Object: Table [dbo].[Import_Finance_Out] Script Date: 11/21/2013 14:46:35 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Import_Finance_Out]') AND type in (N'U'))
DROP TABLE [dbo].[Import_Finance_Out]
GO
/****** Object: Table [dbo].[Import_Finance_Out] Script Date: 11/21/2013 14:46:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Import_Finance_Out](
[gid] [varchar](50) NOT NULL,
[ContractNo] [varchar](50) NOT NULL,
[Customer] [varchar](50) NOT NULL,
[Currency] [varchar](50) NULL,
Financestatus tinyint null,
ExchangeRate [numeric](18, 4) NULL,
Amount [numeric](18, 2) NULL,
RMBAmount [numeric](18, 6) NULL,
Starttime [datetime] NULL,
Endtime [datetime] NULL,
[Days] [int] NULL,
InterestRate [numeric](8, 4) NULL,
Interest [numeric](18, 6) NULL,
[PI] [numeric](18, 6) NULL,
[timemark] [timestamp] NULL,
[Remark] [varchar](150) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/*
financestate gid ContractNo
Customer,bank,Currency,
inExchangeRate,inAmount,inRMBAmount,
inStart,inEnd,inDays,
inInterestRate,inInterest,inPI
timemark
remark
outExchangeRate,outAmount,outRMBAmount,
outStart,outEnd,outDays,
outInterrestRate,outInterest,outPI
gid
ContractNo
Customer
Currency
ExchangeRate
Amount
RMBAmount
Startdate
Enddate
Days
InterestRate
Interest
PI
timemark
Remark
*/
select * from import_finance_out
select * from (select CONVERT(varchar,starttime,23) starttime ,contractno,
customer,'ÈÚ³ö' fname,convert(varchar(50),amount) amount,convert(varchar(50),
exchangerate) exchangerate,rmbamount from import_finance_out union all
select CONVERT(varchar,repaymentdate,23),contractno,'','»¹¿î',
'','',amount from import_finance_outbody)tt
order by contractno,starttime