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 |
|
amueller
Starting Member
1 Post |
Posted - 2009-09-04 : 12:35:19
|
| Hello,I have a query that is pretty simple for the most part, but the varchar(80) is making it difficult on me :)the F01 data is varchar(80), but generally represents numbers like:61.161.762.2...The query is:SELECT TIMESTAMP,(cast(F01 as decimal(5,2))), RECIPE FROM MY_DATA WHERE TIMESTAMP BETWEEN '09/3/2009' AND '09/04/2009' AND F01 >= 55 AND F01 <= 65 AND RECIPE = 'My Recipe' order by TIMESTAMP;But the error returned is:Msg 245, Level 16, State 1, Line 1Conversion failed when converting the varchar value '61.7' to data type int.I have tried all sorts of different CASTS and CONVERTS, but all say about the same :( The problem is that the query is bound directly to a chart control and it doesn't take string - only numeric.Any ideas how I can get this to work? |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-04 : 14:02:08
|
Do your cast in the WHERE clause too or write F01 >= 55.0 AND F01 <= 65.0 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|