473,889 Members | 1,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to find actual LENGTH of a CHAR string

I am using DB2 version 8.2 on Windows XP platform.

I have a table 'EMP' with one field named 'NAME' of type CHAR , size

Also , I have a record with NAME='john'

Now, when I try to find the length of the this name field DB2 returns
80 . Can someone tell me how do I find the actual length of this NAME
field value ('john') without making use of RTRIM.

I say without using RTRIM because, I want to be able to find out the
length of char strings like ' john ' as well .
Thanks in advance

Nov 12 '05
11 60290
Yes, I am a DB2 student.

By the way, can someone tell me that is there a way by which I can
temporarily change this default padding chracter from whitespace to
something else.
Also , is there a way to write a triger on built in functions like
CHAR() ?

Thanks in advance

DA Morgan wrote:
ma****@gmail.co m wrote:
I do not want to make it a VARCHAR field.

Also , my application does not make sense if I fill the remaining part with some other characters.

Is there a way by which I can figure out what value the user has
entered in the column and know the length of this value without
including the remaining white spaces padded by DB2.
Are you a student? It makes no sense to use a fixed length data type
and then expect it to be something other than fixed length.

Daniel A. Morgan
University of Washington
da******@x.wash ington.edu
(replace 'x' with 'u' to respond)
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet

News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World!
100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Nov 12 '05 #11
Serge Rielau schrieb:
ma****@gmail.co m wrote:
I say without using RTRIM because, I want to be able to find out the
length of char strings like ' john ' as well .
LENGTH(RTRIM(LT RIM(' john ')) =>4

could be:
LENGTH(RTRIM(LT RIM('.' || ' john ' || '.'))) - 2 =>9
Nov 12 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Andreas Müller | last post by:
hi @all, I have a char* string array and i want to fill it up in a while loop: while(i<3){ length = read(STDIN_FILENO, inputBuffer, sizeof(inputBuffer); ... } after this the array should look like this:
by: Daniel | last post by:
c# string size limit? length of string limit?
by: gustavo | last post by:
I was looking at the Sendmail's source code, and i've got confused about this kind of initialization: ------------------------ struct prival PrivacyValues = { { "public", PRIV_PUBLIC }, { "needmailhelo", PRIV_NEEDMAILHELO }, { "needexpnhelo", PRIV_NEEDEXPNHELO }, { "needvrfyhelo", PRIV_NEEDVRFYHELO },
by: Guru | last post by:
Im using VS Studio. Net 2005 to find out the transformed length of wide char string based on specific locale (collation). char* p = setlocale(LC_COLLATE,NULL);//US Locale on my machine. wchar_t tp = L"Hello"; size_t size = wcsxfrm(NULL, tp, 0); cout<<"Size "<<size<<endl;
by: krndhi1983 | last post by:
Hi to All, I need a query to Find out the max.length of string in a particular Column. For ex. In a table,One of the column name is EmpName, In this column I want to select max lenth of the String. Any one can help Me?
by: sunil | last post by:
How do I find the length of page in target iframe? I am looking for the code or give me idea to find the length
by: goelvivek | last post by:
write a program to find the length of the string without using control structures and without using string.h header files???
by: Hongyu | last post by:
Hi, I have a datetime char string returned from ctime_r, and it is in the format like ""Wed Jun 30 21:49:08 1993\n\0", which has 26 chars including the last terminate char '\0', and i would like to remove the weekday information that is "Wed" here, and I also would like to replace the spaces char by "_" and also remove the "\n" char. I didn't know how to truncate the string from beginning or replace some chars in a string with another...
by: karimufeed | last post by:
I am working on an access project for pension calculation. I want to find total length of service between two dates. i.e. if the Date of entry into service is 15/3/1980 and the date of retirement will be 31/1/2010 then the total length of service will be 29 years, 10 months, 17 days. Kindly help me how to find the length of service in above said format by using VB code in an access project.
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.