CREATE FUNCTION [dbo].[Table_exists](@TableName VARCHAR(200))RETURNS BITASBEGINIf Exists(select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = @TableName)RETURN 1;
RETURN 0;END
GO
要删除表User(如果存在),请像这样调用它:
IF [dbo].[Table_exists]('User') = 1 Drop table [User]