D
Dino M. Buljubasic
How do I insert a NULL value inside an INSERT statement in an SQL Server
database?
Thank you,
Dino
database?
Thank you,
Dino
Scott M. said:You could use a variable that has been set to = DBNull.Value in the
statement.
Miha Markic said:Hi Dino,
Either use parametrized query and pass DBNull.Value as parameter value or
use a sql statement like:
insert into mytable (field1) values (null);
Dino M. Buljubasic said:Hi Miha,
Using 'null' inside INSERT is not supported anymore. I get error to
use System.DBNull.Value instead but that one inserts an empty string
instead of <NULL>.
Dino M. Buljubasic said:Hi,
thank you for your reply. The code looks like:
INSERT INTO tblTable(fldField) VALUES(Iif(cboCombo.Enabled,
cboCombo.SelectedItem, DBNull.Value))
Dino M. Buljubasic said:Hi,
thank you for your reply. The code looks like:
INSERT INTO tblTable(fldField) VALUES(Iif(cboCombo.Enabled,
cboCombo.SelectedItem, DBNull.Value))
, the fldField is Varchar(10), it allows nulls.
Thank you,
Dino