How to convert text to integer in SQL?

In SQL, How to convert text to integer?

I have a Solution Is Like Below.

Using below function you can convert:

Using CAST or CONVERT function you can convert.

Syntex of CAST or CONVERT function.

Syntax for CAST:
CAST ( expression AS data_type [ (length ) ])
Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )


Use of CAST function to convert table column value in
select clause:

SELECT ProductName, UnitPrice, CAST(UnitPrice AS INT) AS AroundPrice
FROM Products


ProductName UnitPrice AroundPrice
Konbu 6.00 6
Tofu 23.25 23
Genen Shouyu 15.50 16

Above example returns converted unitprice in an integer value named as AroundPrice of table products.

About the Author