|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 4,240,
Visits: 9,487
|
|
T Childers (12/7/2012) Just in case anyone else has gotten here for the same reason I did which was you're trying to build an SSIS package based on a stored procedure that is selecting the data from a temporary table (Select column1, column2, column3 from #tablename).
If you can, it worked better if we used a table variable instead: DECLARE @tablename (Column1 varchar(10), column2 varchar(10), column3 varchar(10) )
Of course, the problem with that is that the data is put all in memory instead of TempDB, but it did resolve our issue.
Unless your table variable is likely to contain fewer than about 100 rows, I would urge you to reconsider.
Your temp table problem will go away if you publish the meta data at the start of your stored proc (a different technique is needed in 2012 - see later).
Here's how to publish your meta data
-- Publish metadata for SSIS if 1 = 0 begin select cast(null as bit) [Col1], cast(null as int) [Col2], etc etc end where the column names and data types line up with what your stored proc will return. Job done.
As I mentioned, in SSIS 2012 this technique no longer works. In fact, things have got tidier, because now the meta data is defined in the EXEC statement:
exec usp_proc1 with result sets ( ([Col1] bit, [Col2] int ); Now on to my final point. It's a common misconception that table variables are held in memory and do not hit tempdb. You might like to do some further reading on this, as others have done the investigative work far better than I. Try this for starters.
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 10:11 AM
Points: 6,
Visits: 139
|
|
Thanks for the additional information and will probably help someone in the future who's googling this error.
In my case, the table was not wide and in general would have less than 50 records and never more than 1500, so although I should have said the data can start out in memory, I would imagine for me it would have stayed in memory and not spilled over to the TempDB.
|
|
|
|