Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drop Temp Table
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01429007
Message ID:
01429010
Views:
39
This was the long thread on this topic Function To Test For Table Doesn't Work Thread #1328338

>Why doesn't this work for temp tables?
>
>
>USE rbp_test
>GO
>
>--DROP PROCEDURE sp_DropTable
>
>GO
>
>CREATE PROCEDURE sp_DropTable
>	@TableName		VARCHAR(50)
>AS
>
>
>	IF EXISTS 
>		(SELECT 1 
>			FROM INFORMATION_SCHEMA.TABLES 
>			WHERE TABLE_TYPE='BASE TABLE' AND 
>				  TABLE_NAME = @TableName) 
>		
>		BEGIN
>		
>			DECLARE @Command VARCHAR(100)
>			SET @Command = 'DROP TABLE ' + @TableName
>		
>			EXECUTE (@Command);
>		END
>
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform