Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 query help

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2013-04-29 : 16:41:23
[code]
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[/code]

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-04-29 : 16:51:52
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

623 Posts

Posted - 2013-04-29 : 21:41:54
[code]
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 [/code]
Go to Top of Page
   

- Advertisement -