1

I've looked at a couple questions similar to this, but none seem to be what I'm looking for. These are the values that I'm getting an error for.

insert into Artist(artistId, artistName)
values(
(1,"Artist1"),
(2,"Artist2"),
(3,"Artist3"),
(4,"Artist4"),
(5,"Artist5"),
(6,"Artist6"),
(7,"Artist7"),
(8,"Artist8"),
(9,"Artist9"),
(10,"Artist10"));

Is it possible that there is a syntax error further up in my code that could be causing this error?

Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118

1 Answers1

2

Remove parentheses:

insert into Artist(artistId, artistName)
values
(1,"Artist1"),
(2,"Artist2"),
(3,"Artist3"),
(4,"Artist4"),
(5,"Artist5"),
(6,"Artist6"),
(7,"Artist7"),
(8,"Artist8"),
(9,"Artist9"),
(10,"Artist10");

SqlFiddleDemo

INSERT syntax:

INSERT INTO tab(column_list)
VALUES (row_1_value_list), (row_2_value_list), ...;
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
  • (Parentheses), [brackets] and {braces}. ;) It *is* the right answer, though. :) – Darwin von Corax Dec 04 '15 at 17:32
  • @DarwinvonCorax Thanks for distinction. I use brackets (meaning round/simple brackets) – Lukasz Szozda Dec 04 '15 at 17:36
  • I was trying to get the query to fold up into one line to avoid scrolling through 100s of insert columns. Is there a way that I could achieve this? – Jacob Fillmore Dec 04 '15 at 17:41
  • @JacobFillmore Just remove line breaks `insert into Artist(artistId, artistName) values(1,"Artist1"),(2,"Artist2"),(3,"Artist3"),(4,"Artist4"),(5,"Artist5"),(6,"Artist6"),(7,"Artist7"),(8,"Artist8"),(9,"Artist9"),(10,"Artist10");` It can be one-liner as well – Lukasz Szozda Dec 04 '15 at 17:43
  • Then you need to scroll over to be able to see it all though :( I was hoping I could collapse/expand it when needed. Thanks for the help. – Jacob Fillmore Dec 04 '15 at 17:47