[SQL Server] 查看数据库中是否有指定的表

CREATE TABLE [dbo].[aaa](
    [aaa] [varchar](255) NULL
)
 
if exists(select * from information_schema.tables where table_name='aaa')
	BEGIN
		DROP TABLE aaa
		select N'有,所以删除了'
	END
else
	BEGIN
		select N'没有'
	END

猜你喜欢

转载自seabird1979.iteye.com/blog/2156574