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)
 Changing results to 3 decimal places

Author  Topic 

JohnMcLaughlin
Starting Member

28 Posts

Posted - 2011-01-28 : 09:36:48
I am trying to compare 2 sets of data. One set has 4 decimal places, the other has 6. How can i change these figures to 3 decimal places so i am able to compare them.

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-01-28 : 09:37:47
convert(decimal(18,3),fld)


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

JohnMcLaughlin
Starting Member

28 Posts

Posted - 2011-01-28 : 09:55:01
Worked!!

Cheers
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2011-01-28 : 13:37:04
ROUND() or CAST() -- don't use the old proprietary CONVERT().

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page
   

- Advertisement -