--查询表结构

CREATE PROCEDURE  sp_QueryTable
@TableName NVARCHAR(200)  --表名
AS
select a.name as table_name, b.name as column_name, c.value as remarks   
    from sys.tables a left join sys.columns b on a.object_id=b.object_id  
    left join sys.extended_properties c on a.object_id=c.major_id  
    where a.name=@TableName and c.minor_id<>0 and b.column_id=c.minor_id  
    and a.schema_id=(  
        select schema_id from sys.schemas where name='dbo'  
    )  


本文转载:CSDN博客