SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 query help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sqlfresher2k7
Aged Yak Warrior

606 Posts

Posted - 04/29/2013 :  16:41:23  Show Profile  Reply with Quote

sourcetable  
-----------

columnname     Type           computed       Length    Precision     scale
---------- ------------    ------------     ---------  ----------   -------	
Test 		numeric		no		9	15   		5    


Query:
select CONVERT(NUMERIC(11, 5), test) Name from sourcetable

I got below error when i ran the above query after showing few records.
Please suggest.

Error:

Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric

Lamprey
Flowing Fount of Yak Knowledge

4347 Posts

Posted - 04/29/2013 :  16:51:52  Show Profile  Reply with Quote
The number you are trying to convert is too large to fit into (11,5). I suggest you increase the size from (11, 5) to (15, 5) to match the datatype of Test.
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

606 Posts

Posted - 04/29/2013 :  21:41:54  Show Profile  Reply with Quote

But i want to store the values to destination from source which has the same size..

I cannot increase the size from (11, 5) to (15, 5) to match the datatype of Test..

SourceQuery:
select CONVERT(NUMERIC(11, 5), test) Name from sourcetable

DestinationTable:

columnname     Type           computed       Length    Precision     scale
---------- ------------    ------------     ---------  ----------   -------	
DestTest 		numeric		no		9	15   		5
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000