if not exists(select 1 from sysobjects where name= 'table_name' and xtype='U') create table table_name(……)
--或者: if object_id('表名') is null create table 表名(a int)
--我连续执行了N次都没有错if not exists(select 1 from sysobjects where name='tb' and xtype='U') create table tb(a int)再分析器里面是不会出错的,不过再bcb里就要出错,不知道怎么会使
sql自己产生的脚本,用于删除表a,你可以参考一下 if exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [a] 将你的语句改为: if not exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) create table table_name
sql自己产生的脚本,用于删除表a,你可以参考一下 if exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [a] 将你的语句改为: if not exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) create table table_name 这个代码我业写过的,执行多次就不行了
create table table_name(……)
if object_id('表名') is null
create table 表名(a int)
create table tb(a int)再分析器里面是不会出错的,不过再bcb里就要出错,不知道怎么会使
if exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [a]
将你的语句改为:
if not exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
create table table_name
if exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [a]
将你的语句改为:
if not exists (select * from dbo.sysobjects where id = object_id(N'[a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
create table table_name
这个代码我业写过的,执行多次就不行了
奶奶的,