Mega Code Archive

 
Categories / MSSQL Tutorial / String Functions
 

STR() converts a numeric value to a string

STR() accepts three arguments: the numeric value, the overall length, and the number of decimal positions. If the integer part of the number and decimal positions is shorter than the overall length, the result is left-padded with spaces. 9> 10> SELECT STR(123.4, 8, 4) 11> GO -------- 123.4000 (1 rows affected)