set @sql = N'create table #tmp_table(guarid int)'
From: Zach (zchauvin10787_at_hotmail.com)
Date: 07/22/04
- Next message: Nitin: "SQL Query problems"
- Previous message: tram: "Re: Distribute objects to multiple servers"
- Next in thread: Eric Sabine: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Reply: Eric Sabine: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Reply: Gregory A. Larsen: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 22 Jul 2004 19:19:21 GMT
When I execute:
declare @sql nvarchar(200)
set @sql = N'create table #tmp_table(guarid int)'
exec sp_executesql @sql
select * from #tmp_table
I get: "Invalid object name '#tmp_table'." and there is no entry in tempdb
However; if I change the temp table to a global table (##tmp_table) it runs
successfully and updates tempdb. Is this a bug or by design?
Thanks in adavnce,
Zach
- Next message: Nitin: "SQL Query problems"
- Previous message: tram: "Re: Distribute objects to multiple servers"
- Next in thread: Eric Sabine: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Reply: Eric Sabine: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Reply: Gregory A. Larsen: "Re: set @sql = N'create table #tmp_table(guarid int)'"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading