if object_id('YourTable')is not null
print '有'
else
print '没'

解决方案 »

  1.   

    在系统表sysobjects中查找
    select * from sysobjects where name=表名
      

  2.   

    有函数:
    if object_id('tablename') is not null
    print 'exist'
      

  3.   

    if exists (select * from dbo.sysobjects where id = object_id(N'[Tablename]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    print 'Tablename 存在'
      

  4.   

    go
    if exists(select * from dbo.sysobjects where name='youtablename')
    print 'youtablename 存在'
    else
    drop youtablename
    go