Prompting for values in SQL script
Views (406)
This is something that I forget 2 seconds after I’ve used it so now I’ll put it here as a note to self.
I have a series of TSQL scripts that I use once in different circumstances and often it’s a while between each go. In some of the I need to add some environment specific information and instead of having to scroll down through the text the query editor offers a way of prompting for parameters through a tagging of text like this:
select <Parameter name, Data type, Default value>
Before executing the script you press CTRL+SHIFT+M (this is the part I usually forget) and that makes the editor prompt you like this:
Replace the Default value with the appropriate text and click OK. This will update your SQL script to this:
select 1234
Not the most mind-blowing thing in the world, but a great help.
This was originally posted here.
*This post is locked for comments