1. 程式人生 > >SQL Server生成實體

SQL Server生成實體

rom row span object val ber server pro pri

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生成實體