得到所有的数据表(用户数据表):  
select  *  from  sysobjects  where  xtype  =  'u'  
得到当前数据表的所有字段:  
select  *  from  syscolumns  where  id  =  object_id('数据表名')

解决方案 »

  1.   

    如果要:获取northwind的所有表的表名
    就use northwind
      

  2.   

    赞同,上边的给出的很详细,其实用户的所有表都在Sysobjects中记录,
    有关列的在表SysColumns中存放。
      

  3.   

    use  databasename
    select * from sysobjects;
      

  4.   

    楼上的都不错
    use northwind
    select  name as 表名  from  sysobjects  where  xtype  =  'u'
      

  5.   

    不对吧 xtype = 'u'仅仅是用户表吧,系统表呢?
      

  6.   

    --查询northwind库中的所有表名
    use northwind
    select  name as 表名 from  sysobjects 
    where  xtype  =  'u' or xtype='s'
      

  7.   

    --查询northwind库中的所有表名
    use northwind
    select  name as 表名 from  sysobjects 
    where  xtype  =  'u' or xtype='s'