RAISERROR N'<\<%7.3s>> syntax, is there documentation that explains this syntax? RRS feed

  • Question

  • Dear Microsoft Forum Member,

    I am reviewing the RAISERROR Microsoft documentation and reference is made to the error message with the syntax N'<\<%7.3s>>'. I do not understand what this syntax is saying. Is there any

    documentation that explains the meaning behind each of these characters? Please let me know.

    Thank you.

    Monday, July 29, 2019 9:36 PM

All replies

  • It is explained at RAISERROR (Transact-SQL) => % [[flag] [width] [. precision] [{h | l}]] type

    %7.3s stands Parameter numeric with precise 7 and scale 3, followed by a string.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, July 30, 2019 6:55 AM
  • To clarify, here is an example:

    RAISERROR('This is a test: <%7.3s>', 1, 1, 'Nattmössa')

    This results in:

    This is a test: <    Nat>
    Msg 50000, Level 1, State 1

    Since this is matter of a string, "scale" is misleading terminology. What it actually means that the width of the value is 7 ot which only three are printed, the rest is blank space.

    This is also explained in the topic for RAISERROR, but it is not particularly intuitive. Nor is it particularly useful.

    Erland Sommarskog, SQL Server MVP,

    Tuesday, July 30, 2019 10:19 AM