Database-specific snippets
Database-specific snippets.
We have 80 or so databases scattered across 200+ instances and many tables have similar names or identical names with differing schemas: compare person.personpe, dbo.person & finance.personpe. This particular is extreme and there are more examples but the principle applies.
I would love to be able to define pe as a snippet at a database level so that I can keep my snippet names short and so that I don't have to rename them manually when I am in SSMS with a lesser used database.
-
Sean Redmond commented
This is true.
At the moment, auto-completion has become useful but it means that the snippets are relegated in importance. They only useful in the databases whose snippets I have defined and I have to constantly think about similarly named tables from other databases.
The snippets are fast though and I don't think that it would be that great a change to introduce this change. One would need a tree structure in the snippets folder and code to tell SQL Prompt which leaf folder to use. -
Thomas Franz commented
Shouldn't the auto completion suggests the person table as soon you are typing pe after a FROM / JOIN etc.?
And even if you have multiple pe%-tables, it is selflearning, so you just need to pick up the correct table once (per day / SSMS-restart) and it will be the top suggestion the next time.