Many code editors have a built-in menu item or keyboard function to get a UUID, for example when I press CTRL + SHIFT + G in Delphi it inserts a GUID at the current position in the source code.
I know that I can use
SELECT NEWID() to generate a UUID, but I have to go to the query result, copy the generated UUID to my clipboard (killing whatever was in there before) and then go back to the code and replace the query which is an awful way of dealing with this.
Is there any function (maybe using IntelliSense code snippets?) to do this in SQL Server Management Studio that I haven't found yet?
Some background on why I need this function, I often write SQL Scripts like this:
INSERT INTO table (table_id, value) VALUES ('112C8DD8-346B-426E-B06C-75BBA97DCD63', 'ABC');
I can't use just call
NEWID(), because I later (in another file) want to refer to the specific row using:
WHERE table_id = '112C8DD8-346B-426E-B06C-75BBA97DCD63'
How can I insert a UUID into the code editor?