Convert INT To VARCHAR SQL
Answer :
Use the convert function.
SELECT CONVERT(varchar(10), field_name) FROM table_name
Use the STR
function:
SELECT STR(field_name) FROM table_name
Arguments
float_expression
Is an expression of approximate numeric (float) data type with a decimal point.
length
Is the total length. This includes decimal point, sign, digits, and spaces. The default is 10.
decimal
Is the number of places to the right of the decimal point. decimal must be less than or equal to 16. If decimal is more than 16 then the result is truncated to sixteen places to the right of the decimal point.
source: https://msdn.microsoft.com/en-us/library/ms189527.aspx
You can use CAST
function:
SELECT CAST(your_column_name AS varchar(10)) FROM your_table_name
Comments
Post a Comment