首页 > 数据库技术 > 详细

SQL Server生成实体

时间:2018-08-08 10:59:59      阅读:206      评论:0      收藏:0      [点我收藏+]
SELECT  /// <summary>
 /// ‘ + CAST(C.value AS NVARCHAR) + ‘
 /// </summary>
 [DataMember]
 public string  + CAST(B.name AS VARCHAR) +  {get;set;}+CHAR(13) AS 属性 ,
        ROW_NUMBER() OVER ( ORDER BY B.name ) AS rnum
INTO    #temp710
FROM    sys.tables A
        INNER JOIN sys.columns B ON B.object_id = A.object_id
        LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id
                                               AND C.minor_id = B.column_id
WHERE   A.name = 表名;

DECLARE @i INT = 1;
DECLARE @count INT = 42;
DECLARE @tempColumn NVARCHAR(500) = ‘‘;
WHILE ( @i <= @count )
    BEGIN
        SELECT  @tempColumn = 属性
        FROM    #temp710 AS t
        WHERE   t.rnum = @i;
        PRINT @tempColumn;
        SET @i = @i + 1;
    END; 
DROP TABLE #temp710;  

 

SQL Server生成实体

原文:https://www.cnblogs.com/li-lun/p/9441406.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!