Have forgotten more SQL than I learnt, which was not much.
I want to copy a template list of steps from one table (the template) into another table (the active, in use table). The active table is as the template table but also has an Owner column. The Owner column is filled to the user supplied value. So on every copy I must also fill the Owner column on the just inserted rows to the user supplied value. Later another copy may take place with another owner.
My question is how to do this with a single SQL statement such that I avoid concurrency issues.
I remember that I can:
INSERT INTO ActiveSteps (StepName, StepDesc) SELECT StepName, StepDesc FROM TemplateSteps
but how would I get OwnerName into ActiveSteps when OwnerName is a operator supplied value?
I could create a temporary table but would then have multiple steps and concurrency issues.
I do not want to lock the database to avoid concurrency, I am looking for an elegant single SQL line if possible.