开发者

how to select only the int values in a column that is nvarchar [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplic开发者_Go百科ate:

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?


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


You check for isnumeric:

select evalcolumn from table where isnumeric(evalcolumn) = 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜