首页 > 代码库 > 表封装与初始化语句
表封装与初始化语句
SELECT ‘private ‘+A.MyDataType+‘ ‘+A.COLUMNNAME+‘;‘ FROM ( Select A.name COLUMNNAME, B.name, CASE WHEN CHARINDEX(‘bigint‘,B.name)>0 then ‘Long‘ WHEN CHARINDEX(‘int‘,B.name)>0 then ‘Integer‘ WHEN CHARINDEX(‘float‘,B.name)>0 then ‘Double‘ WHEN CHARINDEX(‘decimal‘,B.name)>0 then ‘BigDecimal‘ WHEN CHARINDEX(‘char‘,B.name)>0 then ‘String‘ WHEN CHARINDEX(‘datetime‘,B.name)>0 then ‘Date‘ WHEN CHARINDEX(‘bit‘,B.name)>0 then ‘Boolean‘ WHEN CHARINDEX(‘money‘,B.name)>0 then ‘BigDecimal‘ else ‘‘ end MyDataType from syscolumns A LEFT JOIN systypes B ON A.xtype=B.xusertype Where A.ID=OBJECT_ID(‘CurrentStock‘) --and a.name =‘strContractGUID‘ and a.name not like ‘%ufts%‘ and a.name not like ‘%uniqueidentifier%‘ ) A SELECT ‘_Stock.set‘+A.COLUMNNAME+‘(‘+ case when MyDataType=‘Long‘ then ‘0‘ when MyDataType=‘Integer‘ then ‘0‘ when MyDataType=‘Double‘ then ‘0.0‘ when MyDataType=‘BigDecimal‘ then ‘BigDecimal.ZERO‘ when MyDataType=‘String‘ then ‘String‘ when MyDataType=‘Date‘ then ‘new Date()‘ when MyDataType=‘Boolean‘ then ‘0‘ else ‘‘ end +‘)‘ FROM ( Select A.name COLUMNNAME, B.name, CASE WHEN CHARINDEX(‘bigint‘,B.name)>0 then ‘Long‘ WHEN CHARINDEX(‘int‘,B.name)>0 then ‘Integer‘ WHEN CHARINDEX(‘float‘,B.name)>0 then ‘Double‘ WHEN CHARINDEX(‘decimal‘,B.name)>0 then ‘BigDecimal‘ WHEN CHARINDEX(‘char‘,B.name)>0 then ‘String‘ WHEN CHARINDEX(‘datetime‘,B.name)>0 then ‘Date‘ WHEN CHARINDEX(‘bit‘,B.name)>0 then ‘Boolean‘ WHEN CHARINDEX(‘money‘,B.name)>0 then ‘BigDecimal‘ else ‘‘ end MyDataType from syscolumns A LEFT JOIN systypes B ON A.xtype=B.xusertype Where A.ID=OBJECT_ID(‘CurrentStock‘) --and a.name =‘strContractGUID‘ and a.name not like ‘%ufts%‘ and a.name not like ‘%uniqueidentifier%‘ ) A
表封装与初始化语句
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。