سؤال

I'm getting a syntax error and am unable to save my database. The syntax error is supposedly in "CREATE TABLE" but "INSERT" is what gets highlighted.

 CREATE TABLE courses 
    (
    classid integer primary key, 
    name varchar (50), 
    coursenum char(4), 
    credhours integer
    );

 CREATE TABLE takes_courses
    (
    id integer references students(id),
    classid integer references courses (classid),
    semcode char(4)
    );

    INSERT INTO takes_courses
    (id, classid, semcode)
    VALUES
    (500, 1001, "FA14")

    INSERT INTO takes_courses
    (id, classid, semcode)
    VALUES
    (501, 1002, "FA14")

    INSERT INTO takes_courses
    (id, classid, semcode)
    VALUES
    (501, 1003, "SP15")

    INSERT INTO takes_courses
    (id, classid, semcode)
    VALUES
    (502, 1008, "FA15")
هل كانت مفيدة؟

المحلول

You reported "The syntax error is supposedly in "CREATE TABLE" but "INSERT" is what gets highlighted."

That could happen if the INSERT and CREATE TABLE statements are both contained in the same Access query.

But Access will not let you combine multiple statements and execute them as a batch. So you must use a separate query for each statement and execute each separately.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top