Hi All,
I have one table in database in that table,one of the column having data type as varchar so it contains numbers and characters in the data.
I want to use this column in where condition like column>'Data'.how can i achieve this.
Any comments\help highly appreciated.
Thanks,
Balu
Shankar MPosted Dec 3, 2012, 12:24 AM
You can use the NUMERIC function ISNUMERIC to check for numeric value.
The ISNUMERIC function return 1 if the value is a numeric value,0 otherwise.
select ISNUMERIC('1'); returns 1.
select ISNUMERIC('A'); returns 0.
To filter the records based on the column where condition, as it contains both text and numeric value you can simply compare based on the condition you require like,
SELECT *
FROM tablex
WHERE columnname > 'String Compared';
Thanks,
Shankar
Sivaraman DhamodaranPosted Nov 8, 2012, 8:04 AM
So you can not treat that as number column and numeric comparison is not possible as the conversion to number fails.
You can do a string compare like column > 'Alpha Numeric'