Conversion in SQL Server

NicoVB

Well-known member
Joined
Jan 2, 2002
Messages
160
Location
Belgium
I have a column named value. Datatype: nvarchar. I contains decimals and strings. But I want to build a query where you only need the decimals. And then set up a criteria for them.

So:

SELECT ..,value FROM *** WHERE ISNUMERIC(value) = 1 AND value > 175

Gives an error: cannot convert some strings in integers

And:

SELECT ..,value FROM *** WHERE ISNUMERIC(value) = 1 AND CONVERT(decimal,value) > 175

Gives also an error: error converting nvarchar to numeric

I think this is because SQL server tries to convert the whole column to decimal, which is very normal that it doesnt work, because of the other values like strings in the column.

But if I want to specify the amount of values by creating a subquery, he says that i cant have a subquery with more than one value. This is also normal.

But how do I solve this problem??

:-(:-(
 
Back
Top