Several special parameter spellings are needed to use parameter substitution without being hampered by the syntax check. There is also need for special parameter spellings for quoting.

In the following @x is used as alias for the parameters @0-@9.

  • Simple substitution

The parameter is replaced with the posted content.

 

@x: normally


"@x": helps e.g. with column lists


@x==@x: when conditional expressions are needed, e.g. on clause, where clause


/*@x*/: for complete rows outside a SQL command

 

  • Character string substitution

Strings should correctly  be quoted by single quote.

Single quotes located in the string must be doubled.


'@x': normal string

 

  • Object name replacement

If quoted object or column names are to be used then you need to check whether they are correctly quoted by square brackets.

If the close bracket exists within the object name, it must be doubled. If the whole name is already correctly quoted, there is no need for quoting again.

This is different to the behaviour of string substitution and the original QUOTENAME() Function of SQL Server.


[@x]: normal object name


[@x].[@x]: multipart object name. This is first decomposed into its constituent parts (up to four), then the parts are quoted and stitched together separated with point.

 

  • No replacement

If the parameters should remain then this options could be used:

""@x""-> @x


"'@x'" - > '@x'


"[@x]"-> [@x]

Last edited Feb 24, 2011 at 12:40 PM by HenrikBauer, version 1

Comments

No comments yet.