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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-08-10 : 09:40:43
|
Nick writes "I have a table that was poorly designed, and there is a field for numbers which is set up as varchar. Over time some character data has gotten into that field. Now I can use an implicit conversion like: SELECT * FROM tbl WHERE majorkey > 500or an explicit one: SELECT * FROM tbl WHERE CAST(policy as int) > 500with no problems. But when I tried to create a view that pulls this field as an int: SELECT CAST(policy as int) as policy...I get issues when I pull data from this view and compare it to a number: SELECT * FROM vw WHERE policy > 500leads to -> 'Syntax error converting the varchar value 'PENDING' to a column of data type int.' I tried using WHERE isnumeric(policy) = 1 in my view, but it doesn't seem to help.Any ideas?" |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-10 : 10:25:15
|
Add WHERE clause likewhere policy like '[0-9]%' Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
|
|