|
|
| Author |
Message |
Kevin Dcosta
New User
Joined: 01 Jan 2008 Posts: 20 Location: Hyderabad
|
|
|
|
| can the length part of a varchar field be set as zero ? |
|
| Back to top |
|
 |
References
|
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1001 Location: Virginia, USA
|
|
|
|
| Yes |
|
| Back to top |
|
 |
Kevin Dcosta
New User
Joined: 01 Jan 2008 Posts: 20 Location: Hyderabad
|
|
|
|
| i have verified thanks for your quick reply. |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1001 Location: Virginia, USA
|
|
|
|
| Your welcome, I'm glad I passed the test. |
|
| Back to top |
|
 |
Anuj D.
Global Moderator
Joined: 22 Apr 2006 Posts: 2222 Location: Phoenix, AZ
|
|
|
|
Congratulation Craig.. ..!
- Ad |
|
| Back to top |
|
 |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi Kevin,
I have a question. Did you set the length as zero while inserting or while selecting? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1639 Location: germany
|
|
|
|
With a select, it does not matter what value with which the length field has been populated. Db2 will populate the length upon a successful select.
you can set the value to zero for both inserts and updates. |
|
| Back to top |
|
 |
Krishna Velamur
New User
Joined: 22 Aug 2008 Posts: 22 Location: Hyderabad
|
|
|
|
Hi Dick,
We can set the length value to zero while inserting as well as selecting. But as you said it doesn't matter while we are selecting because the length value will be populated. But while inserting, if we give the value as zero, the value in the text field will not be inserted. So i guess it will be better avoiding setting length to zero.
Corrections are welcome. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1639 Location: germany
|
|
|
|
| Quote: |
So i guess it will be better avoiding setting length to zero.
|
not sure what you are trying to say.
depends on what you want in the char portion............
If you do not want anything and it is not a nullable field, a length of zero could be interpreted as no data as apposed to spaces. |
|
| Back to top |
|
 |
|
|