Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Data type In VIEW

Status
Not open for further replies.

bbawkon

IS-IT--Management
Jan 17, 2002
15
0
0
US
Hi all, can't that you enough for the help I find on these forums..

One (Hopefully) quick and easy..

I have a column in a SQL 7.0 database called 'area' which is of type 'int'.

In a view, simplified of couse, I would like to;

SELECT header.[area] / 10 as smAREA
FROM sp50devel.[dbo].[header]

Problem is, smAREA still comes back as an integer, which cuts off some of the data (1 decimal point worth of accuracy to be exact)..

Is there anyway to get the view to return this field in floating notation?

Thanks a LOT,
Ben
 
Code:
SELECT cast(header.[area] as decimal(10,2))/ 10.0 as smAREA
FROM sp50devel.[dbo].[header]
 
this is easy: Just cast it as a float

SELECT cast(header.[area] as float) / 10 as smAREA
FROM sp50devel.[dbo].[header]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top