How to insert null into database table view?

已回答

How do I insert nulls into the table navigator in IDEA 2017.2.5? Seems an empty string is just that an empty string and typing <null> becomes "<null>" also copying a null value and pasting it into another cell it becomes "NULL"? I want to bulk change a number of selected varchar cell values to null.

According to the help text I should be able right click and use 'Set DEFAULT' or 'Set NULL' but these options are not appearing on the context menu?

0

OK worked it out for myself. In this case I needed to manually refresh my schema. Seems that if theres a mismatch then the "set to null" choice isn't made available and it doesn't refresh automatically at all and isn't clear when its out of sync - can still edit, just options are missing.

2

Are you sure the column is nullable? If it is there is Set NULL action available from the column value context menu:

If you have changed the table definition, please try to do Database Tools -> Forget Cached Schemas from Data Source context menu, then re-connect the data source and invoke Synchronize action.

0

Yes other rows in same column was showing nulls - which is how I tried to copy & paste the null values. It was the sync schema that was needed to show the "set to null" menu option. It was a relatively new column added about a month ago, 

0

I had the same problem. I noticed that the varchar column is not nullable.

Therefore, set NULL statement does not appear in the context menu.

The solution is to change the column in your table to nullable.

 

Sorry i can't good speak english

0

I have the same problem in IDEA 2023.1.5. If a column in a table is VARCHAR, i simply cannot set null value to it. Writing "<null>" simply inserts this string as a value.

0

I had the issue that the ‘set NULL’ option was unavailable in the context menu.  However, the problem I had was that the table definition had not been refreshed,  The table contents was show the correct information but the table description was incorrect in lhs menu.  On refresh of the table the ‘set NULL’ option became available. 

2

I needed to refresh the database in the database tab, too, to get the set null option to show up. I would never get it without David's comment (thank you!). In my case I created the column before restarting the IDE, so I would believe that the table definition is always refreshed  on startup, which is apparently not the case. 

0

请先登录再写评论。