sql输出文件包含空值,但我在select语句中使用isnull,这里是我的代码。对于modifier1和modifier2列,我的输出文件中仍然有空值。
Select
A.SvcProvSvcId as 'CDMCode',
A.BillName,
A.[CPT/HCPCSCdVal],
isnull(A.[Modifier 1],'') as Modifier1,
isnull(A.[Modifer 2],'') as Modifier2,
A.RevCdVal,
A.Price
into ##temp_CDM
From ##temp_CDMAllPrices A
inner join
(select max(isnull(LastRateChange,getdate())) Last_Price_Chng,ExtrnId,SvcProvSvcId from ##temp_CDMAllPrices group by ExtrnId,SvcProvSvcId) B
on A.ExtrnId = B.ExtrnId
AND A.SvcProvSvcId = B.SvcProvSvcId
AND isnull(A.LastRateChange,getdate()) = B.Last_Price_Chng
DECLARE @FileLocation varchar(255)
DECLARE @OutputFile varchar(255)
DECLARE @FileName varchar(255)
DECLARE @strCommand varchar(8000)
SET @FileLocation = '\\server\LoadFiles\'
SET @OutputFile = 'ExperianCDM'
SET @FileName = @FileLocation + LTRIM(RTRIM(@OutputFile)) + '.txt'
SET @strCommand = 'bcp "SELECT * from [server].[Database].[##temp_CDM]" queryout ' + @filename +' -t "|" -c -T'
RAISERROR(@FileName, 0, 1) WITH NOWAIT
PRINT @strCommand
EXECUTE master.dbo.xp_cmdShell @strCommand
Drop Table ##temp_CDMAllPrices, ##temp_CDM
暂无答案!
目前还没有任何答案,快来回答吧!