Click here to monitor SSC
SQLServerCentral is supported by Redgate
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
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

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


Group: General Forum Members
Last Login: Wednesday, September 7, 2016 11:02 AM
Points: 18, Visits: 122
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



Group: General Forum Members
Last Login: Tuesday, July 19, 2016 4:34 AM
Points: 2,850, Visits: 4,076
Almost 3 years old thread

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