Solved

Creation of Temporary tables in T-sql

Posted on 2008-10-02
4
451 Views
Last Modified: 2012-05-05
I would like to know whether I should create temporary tables in the main procedure or in the called procedure, and please state your reasons why.
0
Comment
Question by:countrymeister
  • 2
4 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
Please state your programming needs, as that will dicate the use or not use of temporary tables, and not whatever I believe.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
The scope of a temp table can only go down, not up.  So if you think you might need the data in the calling procedure, create it there.  It can be referenced and populated by any procedure in the procedure call stack at that point.
0
 
LVL 1

Author Comment

by:countrymeister
Comment Utility
jimhorn

I have a main procedure which gathers data from the database and makes call to  another four procedures. In one of those four procedures I need to load data into a temporary table which is then used further down by another two procedures for calculatioion and data manipulation.

All the execs for the four procs are done from the main proc.
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 250 total points
Comment Utility
Then the main proc is where it needs to be created in order for the data to be shared.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now