if exists(select 1 from sysobjects where name='表名' and xtype='u')
print '存在'
else
        print '不存在'

解决方案 »

  1.   

    if objects_id('表名') is not null
      select '存在'
    else
      select '不存在'
      

  2.   

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

  3.   

    if objects_id('表名') is not null
      select '存在'
    else
      select '不存在'
      

  4.   

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

  5.   

    if exists(select 1 from sysobjects where name='表名' and xtype='u')
    print '存在'
    else
            print '不存在'
      

  6.   

    if objectproperty(object_id('要判断的表'),'IsUserTable')=1
    print '存在'
    else 
    print '不存在'
      

  7.   

    if objects_id('表名') is not null
      select '存在'
    else
      select '不存在'if exists (select * from sysobjects where name = 'yourtablename' and xtype = 'u')
       print '存在'
    else 
      print '不存在'if objectproperty(object_id('要判断的表'),'IsUserTable')=1
    print '存在'
    else 
    print '不存在'