怎样判断一个表单是不是已经在数据库内出现过呢

解决方案 »

  1.   

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

  2.   

    select * from sysobjects where id=object_id('表名') and xtype='U'
      

  3.   

    少了一个print if exists(select 1 from sysobjects where Name=N'表名'and objectproperty(ID,N'IsUserTable')=1)--用户表
    print  '存在 ' 
    else  
    print '不存在 'go
    楼主在联机帮助里可以看到表的描述:
    syscolumns 记录列名的系统表,这是常用的表
    select * from syscolumns where id=object_id(N'表名')
      

  4.   

    --或select * from information_schema.columns where table_name ='表名'