如何获得表对应的架构名称                

解决方案 »

  1.   


    select d.name as table_name, a.name  as column_name from syscolumns a  inner join sysobjects d on a.id = d.id and d.xtype = 'U' 
    where a.name = '表名'
      

  2.   


    select s.[name]
    from sys.tables as t
    join sys.schemas as s on t.schema_id = s.schema_id
    where t.[name] = '表名'
      

  3.   


    select schema_name([schema_id]) 'schema'
     from sys.objects
     where type='U' and name='[表名]'