Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

How to get a row number which is failing during conversion Expand / Collapse
Author
Message
Posted Friday, January 23, 2009 12:34 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, March 16, 2012 3:51 PM
Points: 83, Visits: 300
Christopher,

That hit right on the money.

Thanks guys so much for your help.

Appreciate it.
Post #642706
Posted Tuesday, August 21, 2012 11:41 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 17, 2014 3:22 PM
Points: 10, Visits: 105
The error is because you need to specify your decimal better. When your looking at the decimal data type it is decimal(TotalPositions, RoundToThe) which is probably causing your issue. So if you had an int of 1334 and specified decimal(4, 2) well you will get an arithmetic overflow error because you forgot to add spaces for the .xx so your decimal should have been decimal(7,2). Hopefully that makes sense if you just increase your decimal corrector position you won't get that error. Good luck!


declare @num1 int = 1334

--select cast(@num1 as decimal(4, 2)) --This will give an error on your
select cast(@num1 as decimal(7, 2)) -- This has correct number of positions to hold

Post #1347991
Posted Friday, December 28, 2012 4:28 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, March 14, 2014 2:19 AM
Points: 2,820, Visits: 3,916
Almost 3 years old thread

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1400868
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse