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 manipulate the following table

Author  Topic 

gamaz
Posting Yak Master

104 Posts

Posted - 2009-04-15 : 11:51:19
Hi,
I have a table which is scripted as follows:
CREATE TABLE [dbo].[tblprojectionold1](
[ordnum] [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[mach] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[hrstorun] [float] NULL
) ON [PRIMARY]

The sameple data is as follows:


select ordnum, mach, hrstorun from tblprojectionold1


R041925 1 1
I020349 0 4
I020425 0 2
R042265 0 1
I020405 0 2
R042294 0 2
I020368 0 2
R042293 0 3
R042220 0 1
R042262 0 2
I020298 1 0.81
I020301 1 19
I020322 1 14
I020189 2 13.4
I020300 2 27
R042228 2 6
R042269 3 0.48
R042008 3 21
I020447 3 4
I020415 3 7
R042190 3 9
R041922 4 13.42
R042297 4 4
R041739 4 10
L003686 5 36.86
L003681 5 3
R041872 5 3
I020432 5 9
R042007 5 23
R042116 6 2
Now corresponding to the following values in the hrstorun field
0.81

13.4

0.48

13.42

36.86
I would like to round the above so that the output after rounding will show as follows:
0.81 will show 1
13.4 will show 13
0.48 will show 0
13.42 will show 13
36.86 will show 37

How does one achive this here.

I appreciate any help for resolution of this problem. Thanks.

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-04-15 : 11:53:49
search for and read ROUND function

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-15 : 13:58:11
select ordnum, mach, cieling(hrstorun) from tblprojectionold1
Go to Top of Page
   

- Advertisement -