当前位置 博文首页 > 程序员A的博客:MSSQL查询生成C#类

    程序员A的博客:MSSQL查询生成C#类

    作者:[db:作者] 时间:2021-06-07 09:16

    SELECT  'public '+(
    CASE when b.name='varchar' then 'string'  WHEN b.name='userdecimal' then 'decimal'  WHEN b.name='smallint' then 'int' 
    WHEN b.name='nvarchar' then 'string'  WHEN b.name='datetime' then 'DateTime?'  WHEN b.name='uniqueidentifier' then 'string' 
     WHEN b.name='char' then 'string'   WHEN b.name='float' then 'double'   WHEN b.name='bigint' then 'Int64' 
    WHEN b.name='tinyint' then 'int'  WHEN b.name='bit' then 'bool'   WHEN b.name='money' then 'decimal'   WHEN b.name='nchar' then 'string' 
    ELSE b.name end )+' '+a.name+' {get;set;}'
    from syscolumns a left join systypes b on a.xusertype=b.xusertype
    where id=object_id('视图')