Link to home
Start Free TrialLog in
Avatar of chandresh43
chandresh43Flag for India

asked on

insert null in sql server

cattable
id int
parentid int
title text

i want to insert null value
in parentid coloum
in asp,net



ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the default on the table was null, then ...

INSERT CATTABLE(id, title) VALUES(1, 'Top of the tree');

or

INSERT CATTABLE(id, parentid, title) VALUES(1, DEFAULT, 'Top of the tree');

http://msdn.microsoft.com/en-us/library/ms174335.aspx contains all the reference you should need for the INSERT statement.
why don't you use nullable datatype from Asp.Net??? look at that

http://www.codeguru.com/csharp/.net/net_asp/tutorials/article.php/c10393

if you have nullable datatype and nothing is assigned in it, it will insert NULL in database.