How to convert VARCHAR to Integer in SQL Server with CAST and CONVERT

If a table column is VARCHAR and has all the numeric values in it, it can be converted to Integer using CAST or CONVERT function.

SELECT CAST(VarcharColumnName AS INT) FROM My_Table
SELECT CONVERT(INT, VarcharColumnName ) FROM My_Table

CAST or CONVERT will throw an error when you try to convert column values from alpha-numeric characters to numeric, and it will not retrieve only numbers when column values are converted from alpha-numeric characters to numeric.