I'm learning how to use SQL Server Management Studio and can't figure out how to insert a new row into a table.
Table Structure:
ID,
Field1,
Field2
Query:
INSERT INTO Table (Field1,Field2) VALUES(1,2)
Error:
Major Error 0x80040E14, Minor Error 25503
I'm probably missing something very simple. Any help would be appreciated.
Ok, I was on the verge of pulling out all of my hair, and it appears using single quotes instead of double quotes fixed the problem.
Now, I want to pull my hair out even more.
Thanks for the replies everyone. This one was my mistake.
Does your table have an auto-incrementing ID
field? If not, you will need to manually specify the value for the ID
in your INSERT
statement.
You can check if the ID
field is auto-incrementing by using the Object Explorer, navigating to the table and expanding the Columns node. Find the ID
column, right-click on it and select Properties. If the Identity property is set to False it means that the ID
field is NOT auto-incrementing.
Your other option for adding a row to the table is to navigate to the table in Object Explorer, right clicking on it and selecting Open Table. You can then go to the last row in the grid and manually enter the values for the columns.
User contributions licensed under CC BY-SA 3.0