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)
 How to get the entere part of a division

Author  Topic 

shifis
Posting Yak Master

157 Posts

Posted - 2009-10-01 : 23:19:49
Hi,
In SQL Server 2005 exist a function to get the entere part of a division?

12\5 =2

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-10-01 : 23:43:15
yes. the mod operator %

select 12 % 5


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

shifis
Posting Yak Master

157 Posts

Posted - 2009-10-02 : 01:26:17
Bad example I mean:

13\5=2

(2 times 5, I need the 2)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-10-02 : 01:35:50
if both the number are integer,

select 13 / 5

will give you 2


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

shifis
Posting Yak Master

157 Posts

Posted - 2009-10-02 : 03:15:49
Mmm

No they can be

20.94/19.135
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-10-02 : 03:17:38
SELECT CAST(20.94 / 19.135 AS INT)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -