sql-serverformattingssmsredgatered-gate-sql-prompt

Redgate SQL Prompt - how to reformat all files in source control repo


Redgate SQL Prompt has a great feature of being able to reformat any open sql query, however I've got a large schema source controlled in SQL Source Control, that has a real mix of standards that I would like to harmonise. It would be too much work to open every object and run SQL Prompts format on each.

How can I auto format my entire SQL Source Control repository using SQL Prompt?


Solution

  • A while back I blogged about how to achieve this:

    Note that it's probably better to script objects as CREATE and search/replace CREATE PROCEDURE to ALTER PROCEDURE to avoid losing permissions/extended properties.