1

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?

David Atkinson
  • 5,759
  • 2
  • 28
  • 35
Neil P
  • 2,920
  • 5
  • 33
  • 64

1 Answers1

1

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.

David Atkinson
  • 5,759
  • 2
  • 28
  • 35
  • 1
    Not quite what I was hoping for, but sounds like it should work. I'm guessing that there is no way to run format over the files in the repository folder – Neil P Mar 31 '16 at 15:53
  • No, that's not possible. Are you hoping to automate this as a continuous process? – David Atkinson Mar 31 '16 at 15:54
  • Shouldn't need to, but may have to do it across a number of different projects, so was hoping for a one click format if possible! – Neil P Mar 31 '16 at 16:04
  • 1
    My "workaround" shouldn't be too many clicks. It's not ideal, but better than doing it object by object! – David Atkinson Mar 31 '16 at 16:10
  • @DavidAtkinson, ability to automate (say from the command line) would be really good when inheriting large SQL code repository from legacy systems/company acquisition/merger. Also for in CI/CD. – HappyTown Apr 28 '17 at 16:18