Solved

Creation of Temporary tables in T-sql

Posted on 2008-10-02
4
491 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 22628664
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
ID: 22628673
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
ID: 22628951
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
ID: 22629671
Then the main proc is where it needs to be created in order for the data to be shared.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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