insert into Ame_FSC_SEBGCelERPTESTING.dbo.結報單頭
SELECT
[賬款編號]=case when [賬款編號] is null then '' else CONVERT(nvarchar(100), CAST([賬款編號] AS decimal(11,0))) end
,[會計年度]=case when [會計年度] is null then '' else CONVERT(nvarchar(100), CAST([會計年度] AS decimal(11,0))) end
,[公司代碼]
,[文件日期]=case when [文件日期] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([文件日期] AS decimal(11,0))) AS DATETIME )end
,[過帳日期]=case when [過帳日期] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([過帳日期] AS decimal(11,0))) AS DATETIME )end
,[交易類型]
,[參考]=case when [參考] is null then '' else CONVERT(nvarchar(100), CAST([參考] AS decimal(11,0))) end
,[請款廠商]=case when [請款廠商] is null then '' else CONVERT(nvarchar(100), CAST([請款廠商] AS decimal(11,0))) end
,[賬款幣別]
,[N]=case when [N] is null then '' else [N] end
,[匯率]=CAST([匯率] AS decimal(11,0))
,[發票未稅金額]=case when [發票含稅金額] is null then 0 else CAST([發票含稅金額] as decimal) end
,[稅額]=case when [稅額] IS null then 0 Else CAST([稅額] as decimal) end
,[發票含稅金額]=case when [發票含稅金額] is null then 0 else CAST([發票含稅金額] as decimal) end
,[稅碼]
,[付款條件]=case when [付款條件] is null then '' else [付款條件] end
,[付款天數]=case when [付款天數] is null then 0 else cast([付款天數] as int)end
,[結報備註]=case when [結報備註] is null then '' else [結報備註] end
,[是否自動計算稅款]=case when [是否自動計算稅款] is null then '' else [是否自動計算稅款] end
,[反轉賬款編號]=case when [反轉賬款編號] is null then '' else CONVERT(nvarchar(100), CAST([反轉賬款編號] AS decimal(11,0))) end
,[反轉賬款會計年度]=case when [反轉賬款會計年度] is null then '' else CONVERT(nvarchar(100), CAST([反轉賬款會計年度] AS decimal(11,0))) end
,[基準日期]=case when [基準日期] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([基準日期] AS decimal(11,0))) AS DATETIME )end
,[淨額到期日]=case when [淨額到期日] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([淨額到期日] AS decimal(11,0))) AS DATETIME )end
,[結報狀態]=case when [結報狀態] is null then '' else CONVERT(nvarchar(100), CAST([結報狀態] AS decimal(11,0))) end
,[結報人]=case when [結報人] is null then '' else [結報人] end
,[拋轉狀態]=case when [拋轉狀態] is null then '' else CONVERT(nvarchar(100), CAST([拋轉狀態] AS decimal(11,0))) end
,[拋轉時間]=case when [拋轉時間] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([拋轉時間] AS decimal(11,0))) AS DATETIME )end
,[建立者]=case when [建立者] is null then '' else [建立者] end
,[建立日期]=case when [建立日期] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([建立日期] AS decimal(11,0))) AS DATETIME )end
,[更改者]=case when [更改者] is null then '' else [更改者] end
,[更改日期]=case when [更改日期]is null then '19000101' else CAST( CONVERT(nvarchar(100), CAST([更改日期] AS decimal(11,0))) AS DATETIME ) end
,[過帳者]=case when [過帳者] is null then '' else [過帳者] end
,[發票日期]=case when [發票日期] is null then '19000101' else
CAST( CONVERT(nvarchar(100), CAST([發票日期] AS decimal(11,0))) AS DATETIME )end
,[送貨廠商編號]=case when [送貨廠商編號] is null then '' else [送貨廠商編號] end
,[本幣未稅]=case when [本幣未稅] is null then 0 else cast([本幣未稅] as decimal) end
,[本幣稅額]=case when [本幣稅額] IS null then 0 else CAST([本幣稅額] as decimal) end
,[是否鎖定]=case when [是否鎖定] is null then '' else [是否鎖定] end
,0
,0
,0
,''
,''
,''
,''
,''
,''
,''
FROM [YY].[dbo].[結報單頭]
SQL數據導入
原创yangying1235 ©著作权
©著作权归作者所有:来自51CTO博客作者yangying1235的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:SQL
下一篇:SQL常用-取得字符串後兩位
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Comate入驻社区体验分享
Comate入驻社区体验
百度 应用开发 数据集 AI 智能编码 -
ETL 導入數據問題
日期格式中有“中午”時,
源文件 日期格式 sql