如何将某数据库里存在的所有表名查找出来

解决方案 »

  1.   

    select name from sysobjects where xtype="U"
      

  2.   


    select name from sysobjects
      

  3.   

    select name from sysobjects where type='U'/*
    name                                                                                                                             
    -------------------------------------
    titleauthor
    stores
    sales
    roysched
    discounts
    jobs
    pub_info
    employee
    税率表
    authors
    publishers
    titles(所影响的行数为 12 行)*/
      

  4.   


    select name from sysobjects
    where xtype='u'
    --忘加条件了,呵呵!
      

  5.   

    use db
    go
    select name from sysobjects where type='U'
      

  6.   

    各位的句子都是在查询分析器里写的吧?
    但我希望是在winform里写这个
    关键是这个指定数据库名怎么写??
    比如:在数据库student里的所有表名
      

  7.   

    select   name   from   库名.dbo.sysobjects where   type='U' 
    哪都一样
      

  8.   

    exec sp_msforeachtable "command1"
      

  9.   


     select name from sysobjects where xtype='u'
      

  10.   

    select   name   from   库名.dbo.sysobjects   where   xtype='u'最好不要绑定库名,因为假如你的数据库名称改了之后,程序也要改动,建议还是动态的获取库名
      

  11.   

    select name from sysobjects where type='U'
      

  12.   


    select name from sysobjects where type='U'