0

Lets just say I have a row which looks like this:

ID(Long), serialNumber(Long)
1           123

I want to update this row with (1,null). How can I do it? So far from my research, I save that on Update, but it ignores null values.

Rigel1121
  • 2,022
  • 1
  • 17
  • 24
user1125331
  • 27
  • 1
  • 4

1 Answers1

0

Try this one. It works:

UPDATE your_table
SET    
serialNumber = null
WHERE  ID = 1;
Rigel1121
  • 2,022
  • 1
  • 17
  • 24
  • I am doing insert with a flag to the statement of "update if exists" so I am not calling directly to update statement. – user1125331 Feb 05 '15 at 03:04
  • You can't Insert a value into a column which already have a value. Unless, what you're trying to say is to Insert another row on which if serialNumber is exist to any of the row, then the serialNumber of a newly inserted row will now be equal to null. Is that so? – Rigel1121 Feb 05 '15 at 03:26