如题,
自己新建一个数据库 test,
里面新建一些表,a,b,c,d ……
如何查询 所有自己创建的表。用命令查询,要如何编写。

解决方案 »

  1.   

    SELECT NAME FROM TEST..SYSOBJECTS WHERE XTYPE='U'
      

  2.   

    select * from a
    select * from b....
      

  3.   

    select name from sysobjects where type='U'
      

  4.   

    误解了,use test
    select * from sysobjects where type='u'
      

  5.   

    use test
    go
    select * from test
      

  6.   

    计算一个库里各个表的记录总数:
    select b.name,a.rowcnt from sysindexes a,sysobjects b 
    where a.id=b.id and a.indid<2 and b.xtype='u'--统计数据库里每个表的详细情况
       EXEC sp_MSforeachtable @command1="sp_spaceused '?'"   --获得每个表的记录数和容量:
       EXEC sp_MSforeachtable @command1="print '?'",
            @command2="sp_spaceused '?'",
            @command3= "SELECT count(*) FROM ? "
      

  7.   

    20、说明:列出数据库里所有的表名 
    select name from sysobjects where type='U' 21、说明:列出表里的所有的列 
    select name from syscolumns where id=object_id('TableName') 
      

  8.   

    fredrickhu,htl258,wufeng4552
    谢谢你们!
      

  9.   

    select name from sysobjects where type='U'
      

  10.   

    use test
    select * from sysobjects where type='u'