if object_id('TB1') is not null
  create table tb1....

解决方案 »

  1.   

    if object_id('TB1') is null
      create table tb1....
      

  2.   

    if not exists(select * from sysobjects where name='tb1' and xtype='u')  create table tb1....
      

  3.   

    object_id( ) 过程、VIEW、PK等均会返回直
      

  4.   

    if object_id('TB1') is null
      create table tb1....
      

  5.   

    if (select count(*) from sysobjects where name='tb1' and xtype='u')<=0  create table tb1....
      

  6.   

    Use DB1
    if not exists (select * from dbo.sysobjects where id = object_id(N'[TB1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
      Create table TB1....
      

  7.   

    啊,迟到了。可能的方法都让人给说了。我没有什么好说的了。ANGEL的方法不错。应该是最完备的。
      

  8.   

    if exists(select 1 from sysobjects where object_id('table_name') is not null 
             and type = 'u')
    drop  table tablename
    go
    create table tablename
    ......