Tuesday, July 19, 2005

Null value in Database

Null can be inserted, updated, and searched in SQL:

If you have a table T1(F1, F2, F3, F4) where F1 is Text, F2 is Date/Time, F3 is Long Integer and F4 is Currency, then you can insert Null:

Insert Into T1(F1, F2, F3, F4) values(null, null, 100, 101)

You can Select based on Null

Select * from T1 Where F1 is Null

You can update a field to Null:

Update T1 set F4 = Null where F1 = Null

You can Insert part of all the Fields and leave all the other Fields Null

Insert Into T1 (F2, F3) Values (#2/3/03#, 100)

(F1 and F4 will be Null)

I have tested all of them on MS Access 2000 database.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home