SELECT 3/4

Last Post 31 Mar 2008 03:57 AM by SQLUSA. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
sachin
New Member
New Member

--
30 Mar 2008 11:43 PM
HELLO,

trying to fetch float value .75 but select 3/4 always give me 0, any idea how to achive this.

thanks and Regards

sachin
sachin
New Member
New Member

--
31 Mar 2008 02:18 AM
it works with "Select 3.0/4.0" but why not with "select 3/4"

select 3.0/4.0


it gives result - .750000
sachin
New Member
New Member

--
31 Mar 2008 02:33 AM
i think 3/4 - SQL treat both as integer and won't return result but when we work with 3.0/4.0 or below convert it works fine

select (convert(decimal(2,1),3)/convert(decimal(2,1),4));
SQLUSA
New Member
New Member

--
31 Mar 2008 03:57 AM
This is the usual way forcing floating poing arithmatic:

select 1.0*3/4

Another way: select convert(money,3)/4

Kalman Toth, Database, Data Warehouse & Business Intelligence Architect
SQL Server 2005 Training - http://www.sqlusa.com/order2005grandslam
You are not authorized to post a reply.

Acceptable Use Policy