请问如何查询某个库下所有的表名
select name from sysobjects where xtype='U'这个只是查询本库下的表

解决方案 »

  1.   

    select *
    from 库名..sysobjects 
    where xtype='U'
      

  2.   

    --表名
    select name from sysobjects
    where type='U'
      

  3.   

    --sql 2000自带库pubs为例
    --表名
    select name from sysobjects
    where type='U'/*
    name                                                                                                                             
    -------------------------------------------------------------------------------------------------------------------------------- 
    titleauthor
    stores
    sales
    dtproperties
    roysched
    discounts
    考A
    jobs
    pub_info
    employee
    commend
    authors
    publishers
    titles(所影响的行数为 14 行)
    */
      

  4.   

    select *
    from 库名..sysobjects 
    where xtype='U'代码引用1楼