Add $Query$ to execute when inserting a snippet
Add $query$ to SQL prompt that allows you to define a query which get executed and the results pasted in place, optionally formatted as VALUES statement
I currently have a snippet that runs
SELECT '(' + CAST(r.RegionId AS VARCHAR(50)) + ',''' + r.RegionDescription + ''',0),'
FROM retail.Regions r
WHERE r.ActiveTo > GETDATE()
ORDER BY r.RegionDescription
I then copy the output and use the $paste$ place holder in another snippet to paste in
DECLARE @regions TABLE (RegionId INT, RegionDescription VARCHAR(50), Active bit)
INSERT @regions (RegionId, RegionDescription, Active)
--$PASTE$ goes here
An improvement would be remove the last comma. A bit like copy from the results pane as an IN clause feature.