SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE   proc   [dbo].[bss] 
( 
@tblname   char(50) 
) 
as 
SELECT   ziduan   =   a.name,leixing=b.name, 
                              ziduansm   =   cast(isnull(g.[value],   ' ')   AS   char(100)) 
FROM   syscolumns   a   LEFT   JOIN 
            systypes   b   ON   a.xusertype   =   b.xusertype   INNER   JOIN 
            sysobjects   d   ON   a.id   =   d   .id   AND   d   .xtype   =   'U '   AND   d   .name   <>   'dtproperties '   LEFT   
            JOIN 
            syscomments   e   ON   a.cdefault   =   e.id   LEFT   JOIN 
            sys.extended_properties   g   ON   a.id   =   g.major_id   AND   a.colid   =   g.minor_id   LEFT   JOIN 
            sys.extended_properties   f   ON   d   .id   =   f.major_id   AND   f.minor_id   =   0 
WHERE   d   .name   =   @tblname 
ORDER   BY   a.id,   a.colorder
 


