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