SELECT CAST(YourVarcharColumn AS INT) FROM YourTable
Using
CONVERT
SELECT CONVERT(INT, YourVarcharColumn) FROM YourTable
SELECT CONVERT(INT, YourVarcharColumn) FROM YourTable
Here
YourVarcharColumn is of SQL type Varchar in table YourTable.
Exceptions:
Exception happens when using
CAST or CONVERT is applied on alpha-numeric and casted/converted to numeric.
No comments:
Post a Comment