码迷,mamicode.com
首页 > 数据库 > 详细

sql 生成javabean实体

时间:2018-05-16 15:22:49      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:eva   detail   and   java   cti   UNC   obj   实体   rtrim(   

select a.name,c.name,b.name,
‘private String ‘+lower(c.name)+‘;‘
from sysobjects a, systypes b, syscolumns c
where a.xtype = ‘u‘
and a.id = c.id
and b.xtype = c.xtype
and b.name <> ‘SYSNAME‘
and a.name=‘T_EVALUATION‘
order by c.id;

select ‘private String ‘ || lower(c.COLUMN_NAME) ||‘;‘ from user_tab_columns c where c.table_name=‘A_JZZ‘

 

select a.name,c.name,b.name,
‘private String ‘+lower(c.name)+‘;‘
from sysobjects a, systypes b, syscolumns c
where a.xtype = ‘u‘
and a.id = c.id
and b.xtype = c.xtype
and b.name <> ‘SYSNAME‘
and a.name=‘T_EVALUATION‘
order by c.id;

 

 

select ‘private String ‘ || lower(c.COLUMN_NAME) ||‘;‘ from user_tab_columns c where c.table_name=‘A_JZZ‘

 

create function PoNumber(@a datetime) returns varchar(50)
begin
declare @id varchar(50),@i int
select top 1 @id=pono from dbo.po where left(pono,8)= convert(varchar(8),@a,112) order by pono desc
if @@rowcount=0
return convert(varchar(8),@a,112)+‘001‘
set @i= rtrim(right(@id,3)) +1
set @id=rtrim(@i)
return convert(varchar(8),@a,112)+right( ‘000‘+@id ,3 )
end

 


select aa.*,
case when cast(aa.ProduceSize as decimal(9,2)) > 0 then aa.ProduceSize + ‘??‘
when cast(aa.ProduceSize2 as decimal(9,2)) > 0 then aa.ProduceSize2 + ‘??‘
when cast(aa.ProduceSize as decimal(9,2)) = 0 and cast(aa.ProduceSize2 as decimal(9,2)) = 0 then aa.ProduceSize + ‘??‘
else aa.ProduceSize end wwwww,
bb.LICENCEID aaaaa,bb.zhuanyiliang,
cast((cast(aa.ProduceSize as decimal(9,2))-
cast(case when bb.zhuanyiliang IS null or bb.zhuanyiliang IS NULL then ‘0‘ else bb.zhuanyiliang end as decimal(9,2))
) as nvarchar) + ‘??‘ ccc
from (
select LicenceID,LicenceName,Address,i.conname,isnull(ProduceSize,0) ProduceSize,isnull(ProduceSize2,0)ProduceSize2,CertificalTime,PeriodTime
from T_Licence left join T_COMMON_INFO i on T_Licence.RegionCode= i.CONCODE and i.objtype=‘101‘) aa
left join (
select LicenceID,SUM(cast(DangerCount as int)) as zhuanyiliang from
T_TranferDetail group by CORPID,LicenceID) bb
on aa.LICENCEID = bb.LICENCEID;

select (cast(‘22.0‘ as decimal(9,2))- cast(‘12.00‘ as decimal(9,2))) ccc;

 

sql 生成javabean实体

标签:eva   detail   and   java   cti   UNC   obj   实体   rtrim(   

原文地址:https://www.cnblogs.com/lovelanglangyou/p/9045300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!