Can the current object in Object Explorer be used in a snippet placeholder?
Wayne_I
Posts: 1 New member
in SQL Prompt
I feel like this ability would at least have been asked about before but I couldn't find any mention of it so apologies if I'm just being dumb.
The snippet placeholder $SERVER$ inserts the name of the connected SQL server and $DBNAME$ inserts the name of the connected database. In a similar vein I would like to create a placeholder like $TABLENAME$ or more generically $OBJECTNAME$ that will insert the name of the object already selected in Object Explorer.
(I know I could use $PASTE$ in the snippet and then remember to slowly click the object twice in Object Explorer, press Ctrl-C and then press Esc, but...blech.)
The snippet placeholder $SERVER$ inserts the name of the connected SQL server and $DBNAME$ inserts the name of the connected database. In a similar vein I would like to create a placeholder like $TABLENAME$ or more generically $OBJECTNAME$ that will insert the name of the object already selected in Object Explorer.
(I know I could use $PASTE$ in the snippet and then remember to slowly click the object twice in Object Explorer, press Ctrl-C and then press Esc, but...blech.)
Tagged:
Answers
As we don't have a default placeholder for such an option, you would be required to setup your own placeholder by doing something such as the below:
It won't pull through the table name unfortunately. For such a feature, I recommend submitting it over on our uservoice forum:
https://redgate.uservoice.com/forums/94413-sql-prompt
The list of current placeholders can be found here:
https://documentation.red-gate.com/sp/sql-code-snippets/managing-snippets#:~:text=Click%C2%A0Save.-,Using%20placeholders,-You%20can%20use
Kind regards,
Kurt McCormick
Product Support Engineer, Redgate
Need help? Take a look at our Help Center