x
login about faq Site discussion (meta-askssc)

SSIS Temp table created in one Execute SQL Task in not available in next SQL Task

Hi Frensz,

Temp table created in one Execute SQL Task of SSIS package in not available in the following SQL Task.

script used is create table tempdb.dbo.test (x int)

Any guidenance in this context?

Aniother note is its working in BIDS but not in production server.

more ▼

asked Sep 07 '11 at 01:51 AM in Default

pvsrinivasrao gravatar image

pvsrinivasrao
174 23 27 27

Have you tried creating the table in a different database?

Sep 07 '11 at 12:21 PM Blackhawk-17
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Temporary tables are generally only available in the session that creates them. Details here http://msdn.microsoft.com/en-us/library/ms174979.aspx. Creating a global temporary table is not considered best practice. If you need the data in a table for the duration of your SSIS/DTS package then why not have a 'real' table in the database specifically for that use? You can easily truncate it when you are done with it if leaving the data in place is a concern.

more ▼

answered Sep 07 '11 at 02:10 AM

Fatherjack gravatar image

Fatherjack ♦♦
38.8k 56 73 104

OP not really describing a temporary table, more a temporary table created in tempdb.

Sep 07 '11 at 12:21 PM Blackhawk-17
(comments are locked)
10|1200 characters needed characters left

We can use the temporary tables in another Execute SQL Task .

Go to the Connection which you have created in Connection Managers and in which connection you want the temporary table to be created.

Go to that Connection Properties and Change the Property RetainSameConnection = True .

It will allow you to access the temporary objects to the next task.

more ▼

answered Sep 09 '11 at 02:27 AM

Kirman gravatar image

Kirman
334 25 29 31

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.