We see if we try to convert an integer to a smaller string, it returns back an asterisks (*) meaning an error has occurred. ![]() This is a safe value for us to convert to because the maximum integer value is -2147483648. Here we are casting the int to a varchar(11). The common need to convert an INT to a string is to then concatenate it with either another int or an existing string. The only difference with the CONVERT function is that it takes an extra optional parameter for style which can affect the way certain data types are displayed after they are converted (an example is with date/time formats). Either of these functions can be used with the exact same result when converting to a string. There are two different functions that can be used when converting an integer to a string.
0 Comments
Leave a Reply. |