I don't even want to think about how many man hours have been spent writing the same queries to join over the exact same tables at my company.
When I first started at my job I identified this as an inefficiency and started writing views in a separate schema for the sole purpose of developer convenience.
My boss didn't like this very much and recommended I start committing my common queries to source control in a separate folder from the production SQL. This makes sense because some scripts require parameters and not all are read only.
What is a Common Query?
- Script used to diagnose certain problems
- Script to view relationships between several tables (doing multiple joins)
- Script that we don't want in a stored procedure because it is often tweaked to diagnose the issue of the day
Issues I want to Address
- Discoverability, queries will be rewritten if nobody can find them
- IDE integration, want to be able to easily view queries in IDE. I've tried the SQL Server Solutions but they really suck because they lock you into only working on that set of files.
I was wondering how all the pro's out there share their common SQL queries.
Thanks