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)
 Decimal problem

Author  Topic 

timaz
Starting Member

1 Post

Posted - 2009-02-18 : 08:03:33
Dear All.

I use SQL 2005.

I tried below select and assumed that it will return 0.2, but it returns 0:

select 1/5

or

select 1/4

Any idea?

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-02-18 : 08:04:32
select 1.0/5

or

select 1/4.0

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-02-18 : 08:08:36
Here is the reason
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -