Edit different rows in a table

I have done that but now when I try and add a row it gives me this error.

Traceback (innermost last):

File “event:actionPerformed”, line 16, in ?

java.lang.Exception: Error executing system.db.runUpdateQuery(INSERT INTO Customers2 (ID) VALUES (NULL), , , false)

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 301: SQL error for “INSERT INTO Customers2 (ID) VALUES (NULL)”: Cannot insert the value NULL into column ‘ID’, table ‘WEDatabase.dbo.Customers2’; column does not allow nulls. INSERT fails.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column ‘ID’, table ‘WEDatabase.dbo.Customers2’; column does not allow nulls. INSERT fails.

java.lang.Exception: java.lang.Exception: Error executing system.db.runUpdateQuery(INSERT INTO Customers2 (ID) VALUES (NULL), , , false)

Ignition v7.2.8 (b178)
Java: Sun Microsystems Inc. 1.6.0_26

and you would think just change ID to allow nulls but since it is set as the primary key it wont allow nulls.

im certainly no expert, but is it possible that you dont have the id column setup to auto increment?

I do not. Not really sure how to do that. I am new to this stuff.
I just looked at the properties of the ID column in Microsoft SQL server Management Studio 2008 and I see Identity Increment and it is set to 0 but all of the properties are all greyed out so I can’t change anything.

Your error is telling you that table cannot take NULL values for the ID column."INSERT INTO Customers2 (ID) VALUES (NULL)": Cannot insert the value NULL into column 'ID', table 'WEDatabase.dbo.Customers2'; column does not allow nulls. INSERT fails.You need to set the ID column to auto-increment if you want to insert a NULL

Each database is different, but in SQLServer Management Studio: Right-click on the table, ‘Design’ it, and click on the id column. In the properties, set the identity to be seeded @ e.g. 1 and to have increment of 1 - save and you’re done.

In MySQL Workbench: Right-click on the table, ‘Alter Table…’, and click on the columns tab. In the row for ID, set the PK and AI check boxes - apply and you’re done.

I set the ID column seed 1 increment 1 saved and I still get the null error

This is the properties I have set for ID and the designer.


That table definition looks perfect. By using an insert statement like INSERT INTO Customers2 (ID) VALUES (NULL)you are telling SQLServer to ignore your auto-increment and instead insert a NULL value into the ID column. Now try something like INSERT INTO Customers2 (name) VALUES ("Joe")

For those of you following along at home, we got this problem ironed out over the phone. The problem was a Python syntax issue, and the correct code was:query = "INSERT INTO customers2 (name, address, phone) VALUES ('name', 'address', 'phone')" system.db.runUpdateQuery(query)