Possible Duplicate:
CAST and IsNumeric
I have a database column that is nvarchar, but i want to only get the rows of the database that have integers in that column field is it possible?
In SQL Server, we can use the ISNUMERIC() function to return numeric values from a column. We can alternatively run a separate query to return all values that contain numeric data.
NVARCHAR is a locale-sensitive character data type that allows storing character data in variable-length fields as strings of single-byte or multibytemultibyteA variable-width encoding is a type of character encoding scheme in which codes of differing lengths are used to encode a character set (a repertoire of symbols) for representation, usually in a computer.https://en.wikipedia.org › wiki › Variable-width_encodingVariable-width encoding - Wikipedia letters, numbers, and other characters supported by the code set of the necessary database locale.
Adding the '.0e0' to the end of the column in the ISNUMERIC check will ensure that only integers will be found.
SELECT *
FROM YourTable
WHERE ISNUMERIC(YourColumn + '.0e0') = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With