Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Cretaing Temporary Table Dynamicaly

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-03 : 09:06:22
Sundararajan writes "How can I create temporary table Dynamically. (ie) I want to create temporary table dynamically like tmptable1, tmptable2, tmptable3...

The Last charcter shouid be a integer and it should be varried dynamicaly"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-07-03 : 09:43:00
quote:

Sundararajan writes "How can I create temporary table Dynamically. (ie) I want to create temporary table dynamically like tmptable1, tmptable2, tmptable3...

The Last charcter shouid be a integer and it should be varried dynamicaly"



You might be better off creating just one temp table and adding an integer column to it with 1, 2, 3, etc. etc. What it is for?

Jonathan Boott, MCDBA
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-07-03 : 10:31:28
Sql Server has a native feature of "TEMP" tables.......which it create and deletes dynamically, and maintains independent of other instances of tables of the same name....


you don't NEED to reinvent the wheel....search here (or BOL) for references to #temp...they work exactly like other SQL tables, with some extra benefits/restrictions...


otherwise, you'll have to go down the "dynamic sql" route....again, search here for examples....

Go to Top of Page
   

- Advertisement -