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
查看全文
相关阅读:
many2many
oneselfone
one2one
10-many2one
08-one2many
05-curd
动态SQl
文件系统缓存dirty_ratio与dirty_background_ratio两个参数区别
expect用法举例
通过命令修改mysql的提示符
原文地址:https://www.cnblogs.com/javawebsoa/p/2458205.html
最新文章
刷题
[ACM]数列分块1-9
[JavaWeb] SpringMvc
[ACM]数列分块,ST表
[ACM] RMQ板子题的多种解法(线段树,ST表,数列分块)
[ACM]数列分块
[ACM] 训练赛题解
AtCoder Beginner Contest 167
Codeforces Round #640 (Div. 4)
Codeforces Round #639 (Div. 2)
热门文章
Prime Path POJ
2020年西北工业大学“编程之星”程序设计挑战赛
Codeforces Round #638 (Div. 2)
Heavy Transportation POJ
Cow Contest (POJ
Educational Codeforces Round 86 (Rated for Div. 2)
Codeforces Round #637 (Div. 2)
30-annotation-sql
cache
columnPropertyUnsame
Copyright © 2011-2022 走看看