SQL Flow Field Guide

STR

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

string transform

What changes

Input
string arguments
Output or change
string or integer
Return type
varchar

Syntax at a glance

STR ( float_expression [ , length [ , decimal ] ] )

Work example

Convert a numeric expression to a right-aligned character representation.

Test Unicode, trailing spaces, collation, empty input, and maximum output length.

Check your work Choose width and decimal count to prevent asterisks or unexpected rounding.

Open Microsoft Learn for full syntax, permissions, and details for your version.