zoukankan
html css js c++ java
SQL Server 根据表名创建实体类的字段和属性
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author: <shipeng.wang> -- Create date: <2009-09-11> -- Description: <根据表名创建实体类的字段和属性> -- ============================================= ALTER proc [dbo].[p_Wsp] @tablename varchar(50) as declare @sql varchar(8000) select @sql=isnull(@sql+char(9)+'private ','public class '+@tablename+char(13)+'{'+char(13)+char(9)+'private ')+ case when a.name in('image','uniqueidentifier','ntext','varchar','ntext','nchar','nvarchar','text','char') then 'string' when a.name in('tinyint','smallint','int','bigint') then 'int' when a.name in('datetime','smalldatetime') then 'DateTime' when a.name in('float','decimal','numeric','money','real','smallmoney') then 'decimal' when a.name ='bit' then 'bool' else a.name end+' '+lower('_'+b.name)+';'+char(13)+char(9)+'public '+ case when a.name in('image','uniqueidentifier','ntext','varchar','ntext','nchar','nvarchar','text','char') then 'string' when a.name in('tinyint','smallint','int') then 'int' when a.name='bigint' then 'long' when a.name in('datetime','smalldatetime') then 'DateTime' when a.name in('float','decimal','numeric','money','real','smallmoney') then 'decimal' when a.name ='bit' then 'bool' else a.name end +' '+b.name+char(13)+char(9)+'{'+char(13)+char(9)+char(9)+'get{return '+lower('_'+b.name)+';}'+ char(13)+char(9)+char(9)+'set{'+lower('_'+b.name)+'=value;}'+char(13)+char(9)+'}'+char(13) from syscolumns b, (select distinct name,xtype from systypes where status=0) a where a.xtype=b.xtype and b.id=object_id(@tablename) set @sql=@sql+'}' print @sql
查看全文
相关阅读:
换个角度思考问题
云南印象
子网掩码划分实例
子网掩码划分工具下载
实景地图
AutoCAD图像输出(输出图像)技巧
两种消费观念
子网掩码划分计算方法及实例
C/C++从入门到高手所有必备PDF书籍收藏
WINCE6.0添加特定的软件键盘
原文地址:https://www.cnblogs.com/javawebsoa/p/2458205.html
最新文章
java反射机制
Ant入门
ant配置 以及 Unable to locate tools.jar
[转载]Java语法总结
java反射机制
[转载]Java中的abstract,static,final修饰符
Ant入门
[转载]Java中的abstract,static,final修饰符
18函数对象&19command模式20函数对象在STL中的应用
Item 17. 函数与数组声明上的比较
热门文章
Item 15.指向类数据成员的指针
Item 13. 拷贝操作(Copy Operations )
Item 14. 函数指针(Function Pointers)
Item 16. 指向成员函数的指针
Item 12. 赋值和初始化(Assignment and Initialization Are Different)
Item09. 强制转换(New Cast Operators)
Item 10.const成员函数 (Meaning of a Const Member Function)
Item 11. 编译器对类的影响(The Compiler Puts Stuff in Classes )
开始向.Net平台升级
一些值得经常看的英美报刊网站(不断补充)
Copyright © 2011-2022 走看看