插入附近的语法不正确

时间:2010-07-07 20:03:08

标签: sql sql-server

我是学生这是作业...... 表格在那里,但没有插入数据。

感谢您的任何建议

Msg 156, Level 15, State 1, Line 181
Incorrect syntax near the keyword 'INSERT'.


USE Mort;
Go


INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('McNamara',
'Juanita',
'923 Parkway',
'La Jolla',
'CA',
'619',
'555-0208',
'Accounting Clerk',
'10/07/2003',
'$12.75',
'F',
'Hispanic',
32);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES
('Stephens',
'Harvey',
'7863 High Bluff Drive',
'La Jolla',
'CA',
'619',
'555-0123',
'Dir. of Fin.
& Acct.',
'3/1/1998',
'$75,000.00',
'M',
'Caucasian',
51);

INSERT INTO 
Employee

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,  
Hire_date,  
Wage,       
Gender,     
Race,           
Age)

VALUES
('Vu',
'Matthew',
'981 Torrey Pines Road',
'La Jolla',
'CA',
'619',
'555-0138',
'Computer Support Specialist',
'8/16/2000',
'$18.50',
'M',
'Asian',
26);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Nguyen',
'Meredith',
'10583 Arenas ST. ',
'La Jolla ',
'CA',
'619',
'555-0102',
'Computer Support Specialist ',
'9/27/1998 ',
'$21.50 ',
'M',
'Caucasian',
25);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Avery',
'Ledonna',
'198 Governor Dr.',
'Del Mar',
'CA',
'619',
'555-0135',
'Asst. - Bakery & Pastry',
'3/28/2003',
'$10.50',
'F',
'African American',
23);

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);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Meier',
'Elaine',
'9703 Orchid Lane',
'Del Mar',
'CA',
'858',
'555-0112',
'Cashier',
'9/10/2000',
'$10.25',
'F',
'Asian',
51);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Quillian',
'Stanley',
'98542 Wandering Road Apt 2-B',
'Del Mar',
'CA',
'760',
'555-0198',
'Asst. - Butchers & Seafood Specialists',
'12/16/1999',
'$11.50 ',
'M',
'American Indian',
29);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Tyink',
'Thomas',
'87592 Pacific Heights Blvd.',
'Del Mar',
'CA',
'858',
'555-0159',
'Asst. - Bakery & Pastry',
'5/1/2001',
'$9.50',
'M',
'African American',
32);

INSERT INTO 
Employee 

(Last_name,
First_name,
Address,
City,
State,
Telephone_area_code,
Telephone_number,
Job_title,
Hire_date,
Wage,
Gender, 
Race,
Age)

VALUES 
('Vance',
'Brent',
'927 Cynthia Lane Parkway',
'Del Mar',
'CA',
'858',
'555-0147',
'Bagger - 30 hours/wk',
'3/29/2001',
'$6.75',
'M',
'Caucasian',
22);

3 个答案:

答案 0 :(得分:5)

你的INSERT INTO Employee...没有VALUES条款(“Ledonna”之后的那个)

请注意,如果您双击Management Studio中的错误消息,它会将您带到代码的问题位置。

答案 1 :(得分:2)

有你的问题:

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);

查看第181行的错误消息。

您需要在insert语句中包含值。

答案 2 :(得分:0)

你错过了一个价值块:

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,

在编辑器中找到“转到行”选项,它将帮助您找到错误的行