I constantly keep querying the Database sometimes for checking the metadata in the DatawareHouse. Lately I realised that have been executing the same long sql statements everyday. So is there a better way of Organising all my Favourite SQL statments or procedures ?
This is what I ended up with.
Create a Table

Table DataSource
The table contains the DatabaseName and the SQL that needs to be executed on that Database
Create the Procedure FavList
FavList Procedure
The above procedure is for listing the SQL statements and the Databases from the Table.
I have inserted my favourite SQL statements in the DataSource table as shown below

Table DataSource
Create the Procedure Fav

Fav Procedure
Run the Procedure with the parameter as the datasourceid to execute your favourite SQL statements.
like Fav 1,Fav 2 etc
The Procedure can be be modified to use the Search Tags
Happy SQL!!!

