## Arithmetic overflow error converting numeric to data type numeric

 Author Message azhar.iqbal499 SSCommitted Group: General Forum Members Points: 1550 Visits: 529 when I run below query I got Error of Arithmetic overflow error converting numeric to data type numericdeclare @a numeric(16,4)set @a=99362600999900.0000the 99362600999900 value before numeric is 14 and variable that i declared is of 16 length. Then why this error is coming ? When I set Length 18 then error removed. Sean Lange SSC Guru Group: General Forum Members Points: 148018 Visits: 18567 azhar.iqbal499 (6/10/2014)when I run below query I got Error of Arithmetic overflow error converting numeric to data type numericdeclare @a numeric(16,4)set @a=99362600999900.0000the 99362600999900 value before numeric is 14 and variable that i declared is of 16 length. Then why this error is coming ? When I set Length 18 then error removed.You might want to visit BOL and look at the numeric datatype. http://msdn.microsoft.com/en-us/library/ms187746.aspxYou are trying to shove 18 digits into a numeric that can only hold 16. The precision is the maximum number of digits, not just the integer portion. _______________________________________________________________Need help? Help us help you. Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.Need to split a string? Try Jeff Modens splitter.Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs Understanding and Using APPLY (Part 1)Understanding and Using APPLY (Part 2) Luis Cazares SSC Guru Group: General Forum Members Points: 95225 Visits: 21192 That's because 16 is the full length. From those 16 positions you need to substract 4 for decimal positions. That gives you 12 positions on the left and 4 positions to the right. Luis C.General Disclaimer:Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2