How can I format a number returned by a sql query

I am using MS-SQL 2005
I have a query that returns inventory items and quantities but the  numbers that are returned have five zeros at the end of each number

so 45 is returned as 45.00000

How can I get it to return just the 45?

Here is my query

Select
[Item #],
Description,
Altitm1,
Mfg,
[Item Class],
QTY_on_Hand,
QTY_Allocated
from vCustomerInventory

Thank You.
LVL 1
Wildone63Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chapmandewCommented:
cast it as an integer:

Select
[Item #],
Description,
Altitm1,
Mfg,
[Item Class],
cast(QTY_on_Hand as int) as qty_on_hand,
cast(QTY_Allocated as int) as qty_allocated
from vCustomerInventory
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sqlrocksCommented:
You may want to consider ROUNDing or FLOORing the fields where you don't want as much precision.

Generic example:

declare @x numeric(18,5)

set @x = 45.5430

select @x
select floor(@x)
select cast(ROUND(@x, 0) as int)


Your query:

Select
[Item #],
Description,
Altitm1,
Mfg,
[Item Class],
FLOOR(QTY_on_Hand),
FLOOR(QTY_Allocated)
from vCustomerInventory

0
Wildone63Author Commented:
Thank You.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.