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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-09-21 : 07:24:29
|
| Robert writes "Is it possible to create a temporary table utilizing EXECUTE and the Create Statement in a variable, for example:Declare @sql varchar(1000)set @sql = 'create table #table(field1 int, field2, char(2))'execute(@sql)" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-21 : 07:31:47
|
| Why do you want to use this?You will lose the table scope after the executionAnyway everything should be in same blockDeclare @sql varchar(1000)set @sql = 'create table #table(field1 int, field2 char(2))Insert into #table values(1,''AB'')Select * from #table'execute(@sql)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|