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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert char into float 2

Status
Not open for further replies.

SRIECH

Technical User
Jan 5, 2001
1
DE
After importing a PARADOX 8 table to SQL Server 2000 I would like to convert a char field into a float format because the values are numeric like "0,08333".

In Access 2000 I use then following querystring:

IIf(Fix([field])>0,Fix([field]),0)+[field]-Fix([field]) AS newfield

Who can I convert this in SQL-Server?

Thanks in advance

Stefan Riech
 
Maybe I don't understand the real problem, but SQL server knows the CONVERT() function.
In your example, this would give :
SELECT CONVERT(float,'0.8333')
You can test this in the query analyser.
And for Access 2000, you can use cdbl("0.8333") to get a float from the string.
Only thing you have to notice is your regional settings : If all this gives a conversion error, it's because the settings of windows are different? Check the decimal symbol in the regional settings. In case it's a comma, it should be checked first in your string if it is a comma.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top