In this post explains how to use the STR function in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server (Transact-SQL), the STR function returns a string representation of a number.
The syntax for the STR function in SQL Server (Transact-SQL) is:
The numeric value to convert to a string.
Optional. The length of the resulting string which includes all digits, decimals, signs, etc. If length is not specified, it will default to 10.
Optional. The number of decimal places to display in the resulting string and can not exceed 16. If decimal_places is not specified, it will default to 0.
The STR function can be used in the following versions of SQL Server (Transact-SQL):
Let's look at some SQL Server STR function examples and explore how to use the STR function in SQL Server (Transact-SQL).
For example: