0

I am getting this error


ERROR: syntax error at or near "("Position: 65```


for the following query


insert into  Employee(no,name,phone) values ((1,Kenit,999999999)(2,Kenit,999999999)(3,Kenit,999999999)(4,Kenit,999999999)(5,Kenit,999999999)(6,Kenit,999999999))
2
  • 2
    You need to quote your string values, remove double () from values and add , after each values sequence Commented Jun 23, 2021 at 8:39
  • stackoverflow.com/a/27639296/905902 Commented Jun 23, 2021 at 8:40

2 Answers 2

3

Probably you need commas between paranthesis for each record. And "Kenit" should be in quotes

insert into  Employee(no,name,phone) values ((1,'Kenit',999999999),
(2,'Kenit',999999999),(3,'Kenit',999999999),(4,'Kenit',999999999),
(5,'Kenit',999999999),(6,'Kenit',999999999))
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, man, it helped I forgot commas in between two records.
@KenitPatel The outer most pair of parentheses is not needed for the VALUES clause. so values (1, ...), (2, ...) is enogh
0

Try googling. Source: https://www.sqlservertutorial.net/sql-server-basics/sql-server-insert-multiple-rows/

INSERT INTO table_name (column_list)
VALUES
    (value_list_1),
    (value_list_2),
    ...
    (value_list_n);

INSERT INTO Employee (no,name,phone) VALUES ((1,Kenit,999999999),(2,Kenit,999999999),(3,Kenit,999999999),(4,Kenit,999999999),(5,Kenit,999999999),(6,Kenit,999999999));

happy to help

also: phone numbers should be saved in strings, as well as your names. so adding quotation marks helps not only in readability of the code it gives required LOGIC:

example:

...('asdf', 123, '+8920841209')

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.