You need to reference the OBJECT_ID as the name is stored internally as a unique name. (it adds hidden characters).Here's something you can run to see what I mean.CREATE TABLE #foo ( [colA] INT , [colB] INT , [colC] VARCHAR(255) )-- This won't workSELECT * FROM tempDb.information_Schema.columns WHERE [table_name] = '#foo'-- This does workSELECT * FROM tempDb.sys.columns WHERE [object_ID] = OBJECT_ID('tempDb..#foo')DROP TABLE #foo
Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION