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)
 Dynamic temporory table in sql server 2005

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-26 : 07:38:16
Dipu writes "How to create a temperory table in sql with dynamic tablename
like

set @TableName = '#table1'

@sql = 'Create table '+ @TableName +' ( userId integer)'"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-09-26 : 07:38:28
Why do you want to do this?
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-09-26 : 07:58:55
Are you trying to get the userid from a particular Table and want to create the TAble.. for each userid???


Chirag
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-26 : 09:14:19
Why do you want to create seperate table for each user?
Read this
http://www.sommarskog.se/dynamic_sql.html


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-09-26 : 09:35:24
It looks like you already have the code to do it, except for the EXECUTE statement.


CODO ERGO SUM
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-09-26 : 10:28:21
quote:
Why do you want to create seperate table for each user?


because he works for one of the consulting firms around my work (or at least wants to code like them)

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -