Skip to content
Advertisement

SQL Insert with AUTO INCREMENT

I am trying to insert 50 values into a DB, the table has two column names, one is an ID column set to auto increment and the other is for a code.

When I attempt to do the insert I get a error.

This is my SQL code:

 INSERT INTO Names (Id, Code) 
 VALUES (NULL, 'CodeHere', NULL, 'CodeHere', NULL, 'CodeHERE' );

Advertisement

Answer

 INSERT INTO Names VALUES ('CodeHere'),('2CodeHere'),('3CodeHere'),('4CodeHere')

just ignore auto increment column.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement