String concatenation and dynamic sql
tchaplin@miningis.com.au
Posts: 20
Why is the following SQL
reformatted to
Why is the + 'SET [col1] = ''UNKNOWN'' ' moved to the top line?
And how can I stop it?
SET @SQL = 'UPDATE ' + @table + ' ' + 'SET [col1] = ''UNKNOWN'' ' + 'WHERE [col1] IS Null'
reformatted to
SET @SQL = 'UPDATE ' + @table + ' ' + 'SET [col1] = ''UNKNOWN'' ' + 'WHERE [col1] IS Null'
Why is the + 'SET [col1] = ''UNKNOWN'' ' moved to the top line?
And how can I stop it?
Comments
There is no specific option to lay out string concatenation but the wrapping will affect it. If you decrease the amount of characters in the wrapping option then it will layout your code as you want. If you increase it then it will place the entire string concatenation on one line. However, the wrapping will also affect other parts of your code that you've selected.