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.
| Author |
Topic |
|
praveen4eva
Starting Member
1 Post |
Posted - 2010-01-30 : 05:50:58
|
| hi i am getting error in SQL for converting varchar to FloatI am trying to do the following Declare @variable1 nvarchar(50)Declare @variable2 float set @variable1='123456.789' --the below lines are throwing errors {Error converting data type nvarchar to float}I tried all of them .. set @variable2=cast(@variable1 as float)select @variable2=cast(@variable1 as float)set @variable2= convert(float,@variable1) Pls help me.. |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-30 : 06:19:46
|
| Runs fine for me, no errors, on SQL 2000, 2005 and 2008.Did you run that exact code? |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2010-01-30 : 10:41:26
|
| Have you attempted to pass a nvarchar such as '----' , that would make it impossible to convert to float.?Based on what you've posted the code is OKJack Vamvas--------------------http://www.ITjobfeed.com |
 |
|
|
|
|
|