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
 General SQL Server Forums
 New to SQL Server Programming
 new query

Author  Topic 

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-23 : 13:35:59
I have a field in my table and I just need to change its value.
Exp:
5.000009999999 should be come 5.01.
What is the function that I should use?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-23 : 13:39:12
Check out the ROUND function in SQL Server Books Online.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-23 : 13:40:19
or use
CAST(YourValue as Numeric(10,2))
Go to Top of Page

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-23 : 13:58:50
Hi,
Here is my query:
select leaveType, hours, status
from entitlementRequest
where clientID = 8679
and status <> 'Denied'
and leaveType = 'VACA'
and leaveDate between '04-01-2008' and '03-31-2009'
and this is result:
leaveType hours status
VACA 2.25 APPROVED
VACA 3.25 APPROVED
VACA 4.0 REQUEST
VACA 7.5 REQUEST
VACA 7.5 REQUEST
VACA 7.5 REQUEST
VACA 7.5 REQUEST


I just want to change the query in such a way that when the status are the same it add all the hours to gether:
For example:
leaveType hours status
VACA 5.5 APPROVED
VACA 34 REQUEST

Then I need to add 5.5+34 .
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-23 : 14:00:42
I'm so confused, what does that have to do with your original question?

select leaveType, SUM(hours) AS hours, status
from entitlementRequest
where clientID = 8679
and status <> 'Denied'
and leaveType = 'VACA'
and leaveDate between '04-01-2008' and '03-31-2009'
GROUP BY leaveType, status

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-23 : 14:01:58
This is a same query as the first one.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-23 : 14:05:47
There is no first query. Your original post is asking about changing a value.

Does the query that I posted solve your new issue?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-23 : 14:08:14
quote:
Originally posted by Sep410

This is a same query as the first one.


Please try to post new questions in seperate thread to avoid confusion.
Go to Top of Page

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-23 : 14:09:01
sure
Go to Top of Page
   

- Advertisement -