Click here to Skip to main content
15,906,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to put blank value to a DATETIME datatype column in sql server


blank value means,full blank,not zero
Posted

You use the keyword NULL to add an undefined value.

For example:
INSERT INTO YourTable (SomeDateTimeField) VALUES (NULL)


Also remember that NULL is always queried using IS NULL or IS NOT NULL operators since it's never equal to anything.

If your dong this from .Net application you use System.DBNull.Value for the appropriate parameter.

Regards,

mika
 
Share this answer
 
The only way you can do that is if you have set "allow null" on the field definitionm. You can then assign a DBNull value to it.

Otherwise, a datetime value is numeric: you cannot assign a blank to it, any more than you can assigne a blank to a number.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900