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 2005 Forums
 Transact-SQL (2005)
 Automatically reducing precision on numerics

Author  Topic 

jholovacs
Posting Yak Master

163 Posts

Posted - 2008-03-26 : 11:41:59
Hi all,

I'm running a transformation script that's taking decimal(18,10) data and trying to shoehorn it into a numeric(9,6). generally this works, as most of the data in the original table is not using anywhere near the precision it's capable of, but once in a while I run into one that does use it.

Is there any way to automagically reduce the precision so that i can cram the data into the destination table?

___________________________
Geek At Large

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-26 : 12:45:46
You mean rounding the value to the destination column precision? have a look at ROUND() function in BOL
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-26 : 13:28:25
How are you inserting the data and what do you want to happen to it?
By default decimals will be rounded with an inser statement so sounds like you are using another method to load the data.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jholovacs
Posting Yak Master

163 Posts

Posted - 2008-12-02 : 15:28:39
sigh... it was a bulk insert operation, and the problem was the data file was malformed. Once it was corrected, the problem ceased to be a problem.

___________________________
Geek At Large
Go to Top of Page
   

- Advertisement -