Export (0) Print
Expand All

xp_sprintf (Transact-SQL)

Formats and stores a series of characters and values in the string output parameter. Each format argument is replaced with the corresponding argument.

Topic link icon Transact-SQL Syntax Conventions


xp_sprintf { string OUTPUT , format }
     [ , argument [ ,...n ] ]

string

Is a varchar variable that receives the output.

OUTPUT

When specified, puts the value of the variable in the output parameter.

format

Is a format character string with placeholders for argument values, similar to that supported by the C-language sprintf function. Currently, only the %s format argument is supported.

argument

Is a character string that represents the value of the corresponding format argument.

n

Is a placeholder that indicates that a maximum of 50 arguments can be specified.

0 (success) or 1 (failure)

xp_sprintf returns the following message:

The command(s) completed successfully.

Requires membership in the public role.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft