if exists (select * from sysobjects where name = 'yourtablename')
   print '存在'
else
   print '不存在'

解决方案 »

  1.   

    if exists (select * from dbo.sysobjects where id = object_id(N'[数据库名].[用户名].[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 
      存在
      

  2.   

    if exists (select * from sysobjects where id = object_id(N'[dbo].[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
      

  3.   

    if exists (select * from sysobjects where name = 'a1' and xtype = 'u')
       print '存在'
    else
       print '不存在'
      

  4.   

    if exists( select 1 from sysobjects where name='你的表名' and xtype='U')
       print 'exists!'
    orif object_id('表名')<>0
       print 'exists!'
      

  5.   

    临时表,在这里
    if  exists (select * from tempdb.dbo.sysobjects where name = '##temp')