Append Query Question

C

Chaplain Doug

Is there a way to do an append query and set a particual
field to a value in all records appended? I am currently
using for exmaple:

INSERT INTO [Grades] SELECT * FROM [Grades Archive] WHERE
[StudentID]=<StudentID>

I want all the records appended to have for instance their
[StudentID] field set to a particular value rather than
the value that currently resides in Grades Archive.
Thanks for the help.
 
J

John Vinson

Is there a way to do an append query and set a particual
field to a value in all records appended? I am currently
using for exmaple:

INSERT INTO [Grades] SELECT * FROM [Grades Archive] WHERE
[StudentID]=<StudentID>

I want all the records appended to have for instance their
[StudentID] field set to a particular value rather than
the value that currently resides in Grades Archive.
Thanks for the help.

You'll need to explicitly name the fields rather than using *.
Something like

INSERT INTO [Grades] (StudentID, ThisField, ThatField)
SELECT 3125, Thisfield, Thatfield
FROM [Grades Archive]
WHERE [Grades Archive].StudentID = 3456

will find all records for student 3456 and insert them into the Grades
table under the ID 3125.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top