Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
[code]select cast((2/3) as numeric(10,5))[/code]Why does this not return 0.66666 ?
jcelko
Esteemed SQL Purist
547 Posts
Posted - 2011-02-21 : 18:28:49
Integer math is done first, then conversion. Duh!--CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL