This command on SQL Server

UPDATE tbl SET name='Hi' WHERE id=''

works if 'id' is placed being an integer value, but it doesn't focus on H2.

What might be the answer?

If ID is integer, you should not use quotes for that value:

UPDATE TEST SET NAME='Hi' WHERE ID = 5; // not ID = '5'

Many databases need the cited version, but aren't needed to through the SQL language specs.

UPDATE TEST SET NAME='Hi' WHERE ID='1'; that's employed in sql server even when id area is integer but when you need to update the row where id is null then make use of below statement : UPDATE TEST SET NAME='Hi' WHERE ID is Null; rather than UPDATE TEST SET NAME='Hi' WHERE ID ='';

And when id is varchar you'll be able to make use of your statement to update the values where ID isn't null and information is unavailable there. But when you need to update the values for record where NULL worth of ID area then make use of

UPDATE TEST SET NAME='Hi' WHERE ID is Null;

H2 throws the best since it can't convert the empty string '' to some number. H2 internally uses java.lang.Long.parseLong("") which fails with java.lang.NumberFormatException: For input string: "".

For that SQL script:

drop table tbl;
create table tbl(id int primary key, name varchar(255));
insert into tbl values(1, 'Hello');
UPDATE tbl SET name='Hi' WHERE id='';

H2 will toss the exception:

Data conversion error converting  [22018-161]

Other databases (PostgreSQL, Apache Derby, HSQLDB) throw an identical exception.

You should utilize several, or IS NULL as with:

UPDATE tbl SET name='Hi' WHERE id IS NULL;

or

UPDATE tbl SET name='Hi' WHERE id = 0;