[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
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
暂无评论。
评论功能维护中,当前仅展示历史评论。