Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL CONVERT Function
SQL > SQL String Functions >
The CONVERT function in MySQL and SQL Server converts data from one data type to another.
The syntax of the CONVERT function is as follows:
CONVERT (expression, [data type])
where [data type] is a valid data type in the RDBMS you are working with.
We use the following table for our example.
This table contains the following rows:
The SQL statement,
SELECT First_Name, CONVERT(Score, Integer) Int_Score FROM Student_Score;
produces the following result set:
CONVERT function in Oracle
In Oracle, the CONVERT function is used differently. It converts a string from one character set to another.
Syntax in Oracle
CONVERT (string, [new character set], [original character set])