SQL Prompt > Format SQL - COLLATE problem
gciric
Posts: 6 Bronze 1
Why is SQL Prompt formatter adding [...] around collation name?
For example:
Formatter would try to do this:
For example:
<div>ALTER TABLE [dbo].[SomeTable] <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Roboto, "Helvetica Neue", Arial, sans-serif;">ADD [NewColumnName] [VARCHAR] (20) COLLATE Latin1_General_CI_AI NULL</span></div>
Formatter would try to do this:
<div>ALTER TABLE [dbo].[SomeTable] <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Roboto, "Helvetica Neue", Arial, sans-serif;">ADD [NewColumnName] [VARCHAR] (20) COLLATE <b>[Latin1_General_CI_AI]</b></span><b style="background-color: transparent; color: inherit; font-size: inherit; font-family: Roboto, "Helvetica Neue", Arial, sans-serif;"> </b><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: Roboto, "Helvetica Neue", Arial, sans-serif;">NULL;</span></div>
which results in an error.
I couldn't find anything in options to exclude collation names from the rule to add square brackets around all identifiers.
It's not a big issue with a small queries with just one or too COLLATE's but it pretty annoying when it's in a long query and COLLATE is used in many places (as part of JOIN, WHERE ...).
I couldn't find anything in options to exclude collation names from the rule to add square brackets around all identifiers.
It's not a big issue with a small queries with just one or too COLLATE's but it pretty annoying when it's in a long query and COLLATE is used in many places (as part of JOIN, WHERE ...).