bldink
bldink

Reputation: 23

SSMS tool/option for correcting casing of DB objects in a script

I have a tool I use all the time from Red Gate called SQL Prompt (Pro version) that among other things, will reformat most T-SQL statements and scripts for me so they are more easy to read or at least are closer to my style. Furthermore, it will schema-qualify your tables, sprocs, views and functions. The last thing I'd like to do is be able to have a script be updated with the proper (as defined in the element's actual definition) casing of the SQL objects name. Is there a tool or add-in available to do this for me and if so, what is it and where can I get it?

For example:

SELECT i.itemid, ...
FROM dbo.items as i
  ...
WHERE ...

...would/could be re-written to:

SELECT i.ItemId, ...
FROM dbo.Items as i
  ...
WHERE ...

...for the table definition:

CREATE TABLE [dbo].[Items](
    [ItemId] [int] NOT NULL,
    ...

I know I'm nit-picking here but if you've ever worked on a LARGE database with LOTS of sprocs, tables, views and/or functions, and you work with a developer or two who loves to code all his/her t-sql in all lower case... You get the idea...

To emphasize my point, compare the following 2 lists:

dbo.ReportSection
dbo.ReportSectionSecure
dbo.ReportsForBatch
dbo.ReportsForSection
dbo.Representment
dbo.RepresentmentCheck
dbo.RepresentmentDetails

...and

dbo.reportsection
dbo.reportsectionsecure
dbo.reportsforbatch
dbo.reportsforsection
dbo.representment
dbo.representmentcheck
dbo.representmentdetails

...you have to focus a bit harder to pick out the individual names in the table/sproc names. Imagine much longer and more convoluted field names and possibly hundreds of them in a single proc...

Upvotes: 1

Views: 76

Answers (1)

Related Questions