View previous topic :: View next topic
|
Author |
Message |
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
hi,
this may be simple question to ask.
But i still confuse on null,space or blank.
please correct me if i am wrong .
Null - A table student is created with 2 colum name and marks .
if i insert say name alone . then there is no values in marks .so its called us Null.
SPACE - i create a table student new with 2 column name and marks.
i insert value say (alen,10) .
Now i delete the value 10 from the marks col in student new table .
can i say the col value is now spaces and not null.
Thanks ,
l.nethaji |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
l.nethaji wrote: |
hi,
this may be simple question to ask.
But i still confuse on null,space or blank.
please correct me if i am wrong .
Null - A table student is created with 2 colum name and marks .
if i insert say name alone . then there is no values in marks .so its called us Null.
SPACE - i create a table student new with 2 column name and marks.
i insert value say (alen,10) .
Now i delete the value 10 from the marks col in student new table .
can i say the col value is now spaces and not null.
Thanks ,
l.nethaji |
It would depend on how the columns are defined, are they defined as "NOT NULL WITH DEFAULT"?
You can not delete a value from a column, you can set it to a different value or to NULL if it is defined to contain allow a NULL. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Space and Blank are the same value - on the mainframe this is x'40'.
There is no value for NULL - NULL is the absence of any value at all.
I believe you need to review what NULL is and the rules for NULLs.
Personally, i recommend NULLs not be used. |
|
Back to top |
|
|
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
hi,
Thanks for the reply.
if the column MARKS is not declared as NOT NULL WITH DEFAULT.
If i create a table student with 2 column( name and marks) .
insert a row into it say (babu,10).
IF i use delete marks from student .
Whether the marks column will have space or it would be null.
Please let me know when the column is said to be blank or space .
Please correct me if am wrong
Thanks in advance
L.Nethaji |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hello Netaji,
I suggest you to brush up your skills in Db2. Just check you cant delete value from 1 column you can update it.
Please read the manuals and let us know if you not clear |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
as said :
Craq Giegerich wrote: |
l.nethaji wrote: |
IF i use delete marks from student |
You can not delete a value from a column, you can set it to a different value or to NULL if it is defined to contain allow a NULL. |
|
|
Back to top |
|
|
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
Hi,
Thanks for the help.
I now understand the delete function.
One final query ,where blank or space comes into picture .
I mean like which scenario these spaces or blank are used in tables in DB2.
Thanks
L.Nethaji |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
l.nethaji wrote: |
Hi,
One final query ,where blank or space comes into picture .
I mean like which scenario these spaces or blank are used in tables in DB2.
|
Setting column value to blank (all spaces) is same as you set it to any other value.. |
|
Back to top |
|
|
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
Hi,
Could you please let me know how the spaces or blank is set to a column.
Suppose i have table t with 2 column name (varchar ) and marks(int eger ),
How do i make sure if the name and marks are set to spaces .
Is ther any query for the same to insert a space to the column mentioned above.
Thanks ,
L.Nethaji |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
How do i make sure if the name and marks are set to spaces . |
You don't. . . Why would you believe it is desirable (or even possible) to have spaces in a column that is defined as numeric?
You need to step back and review your understanding of how database works.
Suggest you follow the link at the top of the page to "IBM Manuals", find the SQL Reference for your release of DB2 and read everything about how to define tables/columns and hot to place/change values in these columns. If you find something in the documentation that is not clear, post what you found and your doubt. Someone shold be able to clarify. |
|
Back to top |
|
|
|