MySQL Forums
Forum List  »  MySQL Workbench

DML: INSERT INTO Without List of Fields
Posted by: Skar .2007
Date: June 26, 2019 08:13AM

MySQL Workbench 8.0.16

Hi all

When you have to insert Data in a SQL Server Database in all the Fields of a Table, it is not necessary to indicate in parentheses the list of all the Fields of said Table.

According to the Official Documentation of MySQL 8.0 this procedure can also be applied.

However when in a Table, for example, Table1 with the Fields: Id (Autogenerated Primary Key), Field2 and Field3 when executing the lower instruction shows an Error:

INSERT INTO Table1
VALUES (Data_Campo2, Data_Country3);

The mistake is:

Error Code: 1136. Column count does not match value count at row 1

Finally to "correct" the instruction like this:

INSERT INTO Table1 (Field2, Field3)
VALUES (Data_Campo2, Data_Country3);

it is possible to insert the Registry without any problem, then ...

The Official Documentation is incorrect or ...
How to implement the INSERT INTO Instruction without Fields list?

Thank you very much already

Options: ReplyQuote


Subject
Views
Written By
Posted
DML: INSERT INTO Without List of Fields
119
June 26, 2019 08:13AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.