Subject Insert from query, but changing one field?
Author Joe Martinez
Here's my situation:

I have a class enrollments table. It contains the student ID, the class
ID, and some other things.

What I want to do is take all of the enrollments (rows in this table), and
copy them to all to another class. This would involve copying all of the
enrollment records with a certain CLASSID back to the same table, but with
a different CLASSID, leaving all of the other fields the same.

So, I'm thinking of something like:

insert into enrollments select * from enrollments where classid = 123

However, this will make duplicate copies of the enrollment record, meaning
that they'll still have classid 123. Somehow in the command, I need to
change the CLASSID of the newly inserted rows to, say, 456.

I want to do this with a single SQL command, not a SP. Is this possible?

Thanks,
Joe