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
查看全文
相关阅读:
redis--列表
redis ——字符串
redis 第一节 redis安装、PHP扩展 、主从
Python--day7
Python--day6
Python爬虫
JSON基础
Python--day5
Python—day3
Windows10 安装QT问题
原文地址:https://www.cnblogs.com/javawebsoa/p/2458205.html
最新文章
字符串练习
python基础(红旗)
熟悉linux命令
大数据概述
LL(1)文法
有穷自动机()
简易c语言文法
词法分析实验报告
词法分析
CentOS7 NFS 服务器防火墙端口设置
热门文章
将进程/服务/程序注册为Linux系统服务systemctl 管理(开机自启动)
nginx自启动通过注册系统服务实现
centos7有网部署kvm
centos7内网安装kvm
linux禁止root用户登录和修改ssh端口
linux查看用户以及用户组
centos7修改服务器时间
centos7网卡启动报错Failed to start LSB: Bring up/down networking.
Centos7查看系统 CPU 核数
python中enumerate函数使用
Copyright © 2011-2022 走看看