码迷,mamicode.com
首页 > 数据库 > 详细

SQL Server生成实体

时间:2018-08-08 11:10:10      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:varchar   ext   rom   set   data   sql   sele   count   ble   

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生成实体

标签:varchar   ext   rom   set   data   sql   sele   count   ble   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!