Nice solution. As a DBA I faced similar tasks many times. My usual way of completing them is by using Excel:
1. Start with 1 column
ALFKI
ANTON
AROUT
BERGS
BOLID
BONAP
BSBEV
CACTU
CONSH
DOGGY
FOLIG
FOLKO
FRANK
FRANR
FRANS
FURIB
2. Insert a column in front of it
3. Type
Placeholder1
in the first cell of this column. Drag and drop the value to populate the whole column.
4. Type
Placeholder2
in the first cell of the 3rd column. Drag and drop the value to populate the whole column.
5. "Save As" to a text file
6. Open the saved text part in notepad. do Edit/Replace replacing
Placeholder1 with
SET NOCOUNT ON SELECT C. CustomerID, C. CompanyName, C.City, O. OrderDate, O. Freight FROM Customers C INNER JOIN Orders O " ON C.CustomerID = O.CustomerID WHERE C.CustomerID = '
then replacing Placeholder2 with a single quote. Make sure all TABs and Commas are replaced with empty strings as well.
Save the output.
It is more simple than it sounds!
Regards,
Anatol Romanov