Provide an option in the SqlNNNScriptGenerator classes to preserve comments
arvindshmicrosoft opened this issue · comments
Is your feature request related to a problem? Please describe.
Some use cases for the Sql*ScriptGenerator classes are actually for code "pretty printing" / formatting. However, using Sql150ScriptGenerator to re-generate the SQL text when provided with an input TSqlFragment, leads to comments (single-line and multi-line) both being excluded from the output.
Describe the solution you'd like
Provide an PreserveComments
property in SqlScriptGeneratorOptions
with the default being true
in the 160 version, and false
in the 150 or lower versions for backward compat.
Describe alternatives you've considered
Token re-writing: substituting a faux print
statement instead of the comment token is a crude workaround. It fails in case the comment is a trailing suffix of a line within a multi-line T-SQL statement.
Would really appreciate if this issue was fixed, it will help greatly with using scriptdom to fix code issues. thank you.
This fix would be a huge help! Not only for me but many others. Thank you.
Completely agree that we need an option to preserve comments when using the script generator.