renee35
MIS
- Jan 30, 2007
- 199
Is there a way to create a case statement for the below formula that states if the number is < 0 then 0:
Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11)
I have tried to create case statement using this code:
Case when Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11) < 0 then 0
ELSE Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11) END
but get this error:
Syntax error converting the varchar value '00000-48278' to a column of data type int.
Reason I am formatting it as such is because this is the requirement for sending it in a flat file.
Any help would be greatly appreciated!!
Thanks a bunch!!
-T
Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11)
I have tried to create case statement using this code:
Case when Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11) < 0 then 0
ELSE Right (replicate ('0',11) + cast (cast(a.ThisPdTaxableWages * 100 as int) as varchar(11)),11) END
but get this error:
Syntax error converting the varchar value '00000-48278' to a column of data type int.
Reason I am formatting it as such is because this is the requirement for sending it in a flat file.
Any help would be greatly appreciated!!
Thanks a bunch!!
-T