| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us | ||
Tips Categories:
Contribute?What's New?
What's Hot? |
Difference between NULL and SPACEby Raghavender Vedakattu Consider a database table, “ZEMPLOYEE”, with the following fields: MANDT EMPNO EMPNAME EMPSAL.Lets insert some records into this table.
Now let’s add a new field
“DEPT (CHAR10)” to this table (without checking the “key” and “initial
values” check boxes), and then activate the table. Since the newly added field
is not a part of primary key, there would be no problems in activating the
table. When the
following two SELECT queries are executed, no records are retrieved even though
many records satisfying the WHERE condition (General assumption what we make). This is the
SELECT query…. Here is the solution: When
we insert a new field to an existing table, NULL values are automatically
inserted into the new field by the system for all existing records. However NULL
and SPACE are not the same.
The logical
expression SQL condition is either "true, false, or unknown". The
expression is UNKNOWN if one of the columns involved in the database contains a
NULL value and such records could be retrieved by using “IS NULL” instead of
SPACE. Please note that the NULL value is inserted only for the
existing records, by the time the new field is being inserted. For all new
records, SPACE or the initial (default) value is inserted. If the new field is inserted by checking the checkbox “initial values”, then the initial values (SPACE in case of characters) are automatically inserted and not the NULL values.
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||