Using Temp table in SSIS package

My target is using SSIS to export the data into Excel file from SQL Command(OLB DB Source).

However. I created a very simple demo to testing the functionality as below(SQL query thing) but nothing can be export successful.

declare @Temptable

table (Id int, Name nvarchar(50))

insert into @Temptable values(1, 'name1')

insert into @Temptable values(2, 'name2')

select Id, Name from @Temptable

In terms of the that SQL Command OLB DB Source component couldn't output the result.

Finally. I found out the solution is that need to set the NOCOUNT to ON

SET NOCOUNT ON

declare @Temptable

table (Id int, Name nvarchar(50))

insert into @Temptable values(1, 'name1')

insert into @Temptable values(2, 'name2')

select Id, Name from @Temptable
原文地址:https://www.cnblogs.com/vincentDr/p/3066013.html