Incorrect syntax near insert

前端 未结 3 515
既然无缘
既然无缘 2021-01-28 18:51

I am a student this is homework... The tables are there but data isn\'t being inserted.

Thanks for any advice

Msg 156, Level 15, State 1, Line 181
Incorrec         


        
相关标签:
3条回答
  • 2021-01-28 19:20

    You have an INSERT INTO Employee... in there without a VALUES clause (The one after "Ledonna")

    Note if you double click on the error message in Management Studio it should take you to the problem bit of code.

    0 讨论(0)
  • 2021-01-28 19:23

    There's your problem:

    INSERT INTO 
    Employee 
    
    (Last_name,
    First_name,
    Address,
    City,
    State,
    Telephone_area_code,
    Telephone_number,
    Job_title,
    Hire_date,
    Wage,
    Gender, 
    Race,
    Age)
    
    INSERT INTO 
    Employee 
    
    (Last_name,
    First_name,
    Address,
    City,
    State,
    Telephone_area_code,
    Telephone_number,
    Job_title,
    Hire_date,
    Wage,
    Gender, 
    Race,
    Age)
    
    VALUES 
    ('Drohos',
    'Craig',
    ' ',
    'Selano Beach',
    'CA',
    '619',
    '555-0202',
    'Assistant Manager',
    '6/15/2000',
    '$51,000.00 ',
    'M',
    'Caucasian',
    32);
    

    Look at the error message, at line 181.

    You need to have values with your insert statement.

    0 讨论(0)
  • 2021-01-28 19:42

    You missed a value block:

    Hire_date,
    Wage,
    Gender, 
    Race,
    Age) -- MISSING VALUES HERE
    
    INSERT INTO -- THIS IS LINE 181
    Employee 
    
    (Last_name,
    First_name,
    Address,
    City,
    State,
    Telephone_area_code,
    Telephone_number,
    

    find the "Go to line" option in your editor it will help you to find the wrong line

    0 讨论(0)
提交回复
热议问题