我的企業應用程序僅支持從SQL服務器中選擇的數據進行報告。在一個業務流程中,我有非常複雜的存儲過程,它使用其他存儲過程,它被設計爲將結果打印爲日誌任務完成。我想要捕獲的打印出來,並選擇它作爲varchar(最大),所以我的應用程序可以處理該數據並顯示給用戶。
下面是示例場景TSQL代碼描述:SQL選擇打印出存儲過程的結果
create procedure sp_test_print_out
as
begin
Print 'Test';
print 'Test 1';
end
go
create procedure sp_test_print_out_to_select
as
declare @printOut varchar(max)
set @printOut = exec sp_test_print_out --How I can achieve this ?
select @printOut
end
go
exec sp_test_print_out_to_select
感謝名單,這也是在我心中,我是箍,以便有其他更簡單的方法處理,然後輸出參數。所以我現在需要處理所有打印出來的數據,包括新行,error_messages和其他內容 – adopilot 2010-09-30 09:48:14