x

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, 2011 at 01:51 AM in Default

pvsrinivasrao gravatar image

pvsrinivasrao
174 26 27 27

Have you tried creating the table in a different database?
Sep 07, 2011 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, 2011 at 02:10 AM

Fatherjack gravatar image

Fatherjack ♦♦
42.7k 75 79 108

OP not really describing a temporary table, more a temporary table created in tempdb.
Sep 07, 2011 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, 2011 at 02:27 AM

Kirman gravatar image

Kirman
334 29 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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1840
x937
x66

asked: Sep 07, 2011 at 01:51 AM

Seen: 3445 times

Last Updated: Sep 07, 2011 at 01:52 AM