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
查看全文
相关阅读:
Day 7 测试用例设计(二)场景流程分析法、正交表法、状态迁移法、
Day 6 测试用例设计(一)等价类、边界值、判定表、因果图
Day 5 网络基础 & SVN的使用
Day 4 shell脚本
gitlab-runner (一)
大数据(二)Elasticsearch 分布式搜索引擎(存索引、索引搜索)
大数据(一)from 北鼻 消息中间件 + 数据计算+数据存储=数据管理
关系型数据库、非关系型数据库
SVN 版本管理工具 Gitlab 仓库管理系统 Git 代码管理工具
Day 2 & 3 linux常用命令, vim
原文地址:https://www.cnblogs.com/javawebsoa/p/2458205.html
最新文章
人月神话阅读笔记2
人月神话阅读笔记1
个人课程总结
5.31
梦断代码06
5.30
对于自己使用的输入法或者搜索类软件的使用
结队开发之四则运算
找水王
5.24
热门文章
2020暑假学习记录——7
2020暑假学习记录——6
2020暑假学习记录——5
2020暑假学习记录——4
2020暑假学习记录——3
2020暑假学习记录——2
2020暑假学习记录——1
大二下软件工程总结
1
第十五周学习总结
Copyright © 2011-2022 走看看