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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-01-26 : 05:59:03
|
HI,What is wrong with this query please?It says: There is already an object named '#tblData' in the databaseif EXISTS ( select * from sys.tables where name like '#tblData') DROP TABLE #tblDataThanks |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-01-26 : 06:04:51
|
try:IF OBJECT_ID('tempdb..#tblData') IS NOT NULL DROP TABLE #tblData temp tables live in a different database (tempdb) and have to be referenced there. Also, local temp tables have a virutal name ('#tblData' but their real name is like '#tblData_________________________________45AF23') so they can be unique.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-01-26 : 06:17:50
|
thank you |
 |
|
|
|
|