We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

temporary tables in sql server 2005 how persistent is it

Medium Priority
298 Views
Last Modified: 2012-05-06
on a sql agent job created 2 steps
step1 creates temporary tables by running sql script
step2 reads these temporary tables, does some processing and writes to a new table

what i found was, as soon as the step1, exists, the temporary tables disappears

how persistent are the temporary tables. can it be used across different sessions

Thanks
Comment
Watch Question

Temporary tables go out of scope when the connection is disconnected.  If Storedprocedure1 creates a temp table, and it then calls StoredProcedure2, StoredProcedure2 can access it.  When Step 1 exits, the table goes out of scope and is dropped so Step 2 cannot access it.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Awarded 2008
Awarded 2008
Commented:
global temp tables (prefixed with ##), go out to scope when ALL connections using them go out of scope

Author

Commented:
Does global temporary table work across steps in the SQL Agent job

"ALL connections using them go out of scope"
When step1 completes, there are no connects to the tables. Does this constitute ALL connections
Then when step2 starts, (probably a different session id), can it see GTT

Thanks

CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
yes, in that case it would go out to scope (even the global)...why not use a user-table instead?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.