任何人都可以告訴我我在這裏做錯了什麼?我試圖基於我操縱的數據來查詢到一個平面文件。我不斷收到下面的代碼錯誤。 感謝您的幫助!我不斷收到bcp錯誤
任何人都可以告訴我我在做什麼錯在這裏?我試圖基於我操縱的數據來查詢到一個平面文件。我不斷收到下面的代碼錯誤。 感謝您的幫助!
declare variables....
select @effDate = effective_date from c_flt_src
if convert(varchar(10), @effDate, 112) = convert (varchar(10), GETDATE(),112)
set @sqleffdate = convert(varchar(10), @effDate, 112)
begin
select @all = store from c_flt_src where store = 'ALL'
if @@ROWCOUNT = 1 and @all = 'ALL'
select @action = action from c_flt_src
if @action = 'INCREASE' or @action = 'DECREASE'
set @actiontyp = 'UPDATE_STORE'
else if @action = 'REPLACE'
set @actiontyp = 'RESET_STORE'
select @a = a_amt from c_flt_src
select @b = b_amt from c_flt_src
begin
declare @c as cursor
set @c = CURSOR fast_forward for select distinct top 3 store from store_loc where store <> 0 order by store
open @c
fetch next from @c into @store
while @@FETCH_STATUS = 0
begin
--process data here
set @sql = @sqlaction + '|' + @actiontyp + '|' + @store + '|' + @a + '|' + @b
set @sql1 = '"'+'D:\file.'[email protected]+'.9999999.'+REPLICATE ('0', 3-LEN(@store)) + @store +'.deltaloc' + '"'
select @sql1
declare @s varchar(max)
set @s = ''''+'bcp "select ''''' + @sql + '''''"' + ' queryout ' + @sql1+ ' -c -t "|" -T'+''''
select @s
execute master.dbo.xp_cmdshell @s
fetch next from @c into @store
end
close @c
deallocate @c
end
end
你在哪一行得到錯誤? – hallie
什麼是錯誤????? – valex
執行bcp時出錯。錯誤是「程序需要'varchar''類型的參數'command_String'。我不明白爲什麼我得到這個,因爲我把參數放到一個varchar變量(@s) – user2885241