Forgive me as I’m relatively new to SQL. But I’m trying to take modified data from a SELECT query on one table, and use it to populate data into another table.
SELECT ID FROM TABLE WHERE VALUE=10
I want to insert the resultant ID’s into another Table, but with modifications such that the value is:
1stString.ID.2ndString
I’ve found answers for how to use the ID from the SELECT in the insert, but I can’t seem to get it working when trying to concatenate. There are also other values that I’m inserting, but they’re literals (I’m trying to initialize default key settings for the ID’s given in another table.
Using MS SQL Studio 2008, btw.
Edit – response to comment:
You’re on the right track, but you want to select your hard-coded strings from your table, like this:
This is also illustrated in Dustin Laine’s answer.