Format SQL fails when using TRIM() function
tentrade
Posts: 4 Bronze 1
in SQL Prompt
I have the following line in my T-SQL
When this line is present the 'Format SQL' fails with Exception "Cannot align to a future token "," at line 73, column 21, offset 2919". Column 26,27 and 28 are ',' in the select statement.
If I comment out this line, then the 'Format SQL' completes successfully.
SELECT @sql=TRIM(',' FROM @sql)
When this line is present the 'Format SQL' fails with Exception "Cannot align to a future token "," at line 73, column 21, offset 2919". Column 26,27 and 28 are ',' in the select statement.
If I comment out this line, then the 'Format SQL' completes successfully.
Tagged:
Answers
Here is the full script (Format SQL works if the line with TRIM() in it is commented out)
SQL Server: 14.0.2027.2
However, when TRIM is not in the first column "Format SQL" fails with "Exception: Cannot align to a future token "AW" at line 2, column 10, offset 37", e.g.:
I'm using 9.5.19.11631.