第一:怎么查询一个表的所有字段第二:怎么查询字段前四位的内容

解决方案 »

  1.   


    1.select * from tb2.select left(col ,4) from tb where len(col) > 4
      

  2.   


    1
     SELECT  a.name 字段名  FROM syscolumns a left join systypes b on a.xtype=b.xusertype 
           inner join sysobjects d on a.id=d.id 
           and d.xtype='U' and d.name<>'dtproperties' left join syscomments e on a.cdefault=e.id left join
           sysproperties g on a.id=g.id and a.colid=g.smallid  where d.name='表名'order by a.id,a.colorder
    2
     SELECT  left(a.name,4)  FROM syscolumns a left join systypes b on a.xtype=b.xusertype 
           inner join sysobjects d on a.id=d.id 
           and d.xtype='U' and d.name<>'dtproperties' left join syscomments e on a.cdefault=e.id left join
           sysproperties g on a.id=g.id and a.colid=g.smallid  where d.name='表名' and len(a.name>4 order by a.id,a.colorder
      

  3.   

    select * from tb where 1=2