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 |
|
pssheba
Yak Posting Veteran
95 Posts |
Posted - 2009-10-14 : 08:47:54
|
Hi everyone,I'd like to create a temporary table from within a sp. That action willfail if a temporary table of the same name already exists so i check ifit exists first using the following code:IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID(tempdb..#xxx))DROP TABLE tempdb..#xxx But i get an error message that says: quote: Msg 4104, Level 16, State 1, Line 1The multi-part identifier "tempdb..#xxx" could not be bound.
Anyone knows what that error message means ? Anyone knows how else i can delete that table ?Thanks |
|
|
rocknpop
Posting Yak Master
201 Posts |
Posted - 2009-10-14 : 08:51:16
|
| Apply single quotes in:OBJECT_ID('tempdb..#xxx')--------------------Rock n Roll with SQL |
 |
|
|
smarty
Starting Member
13 Posts |
Posted - 2009-10-14 : 08:58:28
|
| If object_id('tempdb..#xxx') IS NOT NULL DROP TABLE tempdb..#xxx-----------------------------------Free SQL server monitoring for DBA'swww.realsmartsoftware.co.uk |
 |
|
|
pssheba
Yak Posting Veteran
95 Posts |
Posted - 2009-10-15 : 02:47:35
|
| Thanks a lot, the error message was removed using that syntax |
 |
|
|
|
|
|