SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 mathematical
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

svicky9
Posting Yak Master

United Kingdom
232 Posts

Posted - 07/25/2006 :  11:32:52  Show Profile  Visit svicky9's Homepage

select 5/2

The answer is 2

how can i get the decimal solution 2.5

thanks
Vic

RyanRandall
Flowing Fount of Yak Knowledge

United Kingdom
1074 Posts

Posted - 07/25/2006 :  11:34:12  Show Profile
select 5.0/2


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

svicky9
Posting Yak Master

United Kingdom
232 Posts

Posted - 07/25/2006 :  11:37:46  Show Profile  Visit svicky9's Homepage
but if i want to use variables how do i proceed

like

declare @a int
set @a= 5
select @a/2
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30281 Posts

Posted - 07/25/2006 :  11:40:27  Show Profile  Visit SwePeso's Homepage
declare @a int
set @a= 5
select @a/2.0
Or
declare @a int, @b int
set @a= 5, @b  = 2
select 1.0 * @a / @b



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Srinika
Flowing Fount of Yak Knowledge

Sri Lanka
1378 Posts

Posted - 07/25/2006 :  11:42:44  Show Profile
declare @a int, @b decimal (8,2)
set @a = 5
set @b = convert(decimal (8,2), @a)
select @b/2


Srinika
Go to Top of Page

svicky9
Posting Yak Master

United Kingdom
232 Posts

Posted - 07/25/2006 :  11:51:25  Show Profile  Visit svicky9's Homepage
hi friends thanks for the reply...is there any function in the Sql server that will calculate the reminder for the 2 numbers

I tried the BOL but no use...

Is there any formula???

Vic
Go to Top of Page

svicky9
Posting Yak Master

United Kingdom
232 Posts

Posted - 07/25/2006 :  11:53:15  Show Profile  Visit svicky9's Homepage
sorry got it its %

Vic
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000