2、
select  
    a.name,
    case when b.id is null then '存在' else '不存在' end
from 
    (select id,name from sysobjects where xtype='U') a
left join
    (select id from syscolumns where name='ID') b
on
    a.id = b.id

解决方案 »

  1.   

    在楼上写反了:select  
        a.name,
        case when b.id is null then '不存在' else '存在' end
    from 
        (select id,name from sysobjects where xtype='U') a
    left join
        (select id from syscolumns where name='ID') b
    on
        a.id = b.id
      

  2.   

    数表的字段
    select count(*) from syscolumns where id = object_id('表名')
    --2:?取某一个表的所有字段select name from syscolumns where id=object_id('表名')--6:??某一个表的字段和数据?型select column_name,data_type from information_schema.columns
    where table_name = '表名' 
      

  3.   

    select id=1000,userName='tudou' from syscolumns这种方式为什么查询出来N多的记录呢???
      

  4.   

    明白着是个假象啊,我改成select id=1000,userName='冬瓜' from syscolumns也能检索出来N条
      

  5.   

    declare @tn varchar(5000)
    set @tn = ''
    select @tn=@tn+'['+[name]+'],' from dbo.sysobjects where xtype = 'U'
    set @tn ='select * from '+ left(@tn,len(@tn)-1)
    exec(@tn)
      

  6.   

    TO: vivianfdlpw() 数据库master中各种表的用途的说明在连机文档的哪个地方??还有1个问题:客户端不直接访问 Microsoft® SQL Server™ 2000,而是使用为访问 SQL Server 中的数据而编写的应用程序。那么我该如何模拟这个过程:通过客户端实用工具,我建立了到另1台安装有SQL SERVER2000的计算机的的TCP/IP连接,(不编程的情况下)怎么才能看到对方机器上的数据或者其它东西??
      

  7.   

    谢谢楼上各位前辈放分帖在:http://community.csdn.net/Expert/topic/4347/4347163.xml?temp=.5393183
      

  8.   

    加上系統表sysobjects和函數object_id()
      

  9.   

    select  
        aa.name,
        case when bb.id is null then '不存在' else '存在' end
    from 
        (select id,name from sysobjects where xtype='U') aa
    left join
        (select id from syscolumns where name='ID') bb
    on
        aa.id = bb.id--sysobjects 和syscolumns 都是系统表,记录着用户表的信息