if exists (select * from dbo.sysobjects where id = object_id(N'[tablename]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
SQL语句
GO

解决方案 »

  1.   

    用该语句判断
    if exists(select 1 from sysobjects where xtype='u' and name='表名')
        print 'aaa'
    else 
        print 'not exists'
      

  2.   

    select count(*) from sysobjects where name = '表名';如果count > 0就说明存在该表。
      

  3.   

    if exists (select * from dbo.sysobjects 
    where id = object_id(N'[tablename]')
    print "存在该表"
      

  4.   

    if objects_id('表名') is not NULL and exists(select 1 from dbo.sysobjects 
    where name ='表名')
    begin
      .........
      print '存在该表'
    end
      

  5.   

    建议用OBJECT_ID来判断(避免同其他OBJECT也同名)
    if  object_id(N'[Utable]') is not NULL
    create table Utable(.........)
      

  6.   

    use 库名
    if IsNull(Object_ID('aa'),0)<>0
      Print '表存在'
    else
      Print '表不存在'
      

  7.   

    if exists (select * from dbo.sysobjects where id = object_id(N'[tablename]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)在系统表sysobjects中记录了数据库中所有的表,包括系统表
    在系统表syscolumns中记录了数据库中所有表中的所有字段
      

  8.   

    if  object_id('表名') is not NULL
     就可以了
      

  9.   

    if exists(select * form dbo.sysobjects where id = object_id('tableName') and xtype='U')
    print 'true'
    or
    if object_id('tableName') is not null
    print 'true'
      

  10.   

    declare @TableName varchar(50)
    select @TableName='author'
    if object_id(@TableName) is not null
      print 'true'
    else
    print 'false'
      

  11.   

    select * from dbo.sysobjects where name ='表名'
      

  12.   

    如果是一般的表在sysobjects这个系统表中。
    如果事临时表在tempdb中。 
    sysobjects
    在数据库内创建的每个对象(约束、默认值、日志、规则、存储过程等)在表中占一行。只有在 tempdb 内,每个临时对象才在该表中占一行。