Hi,
column nme: TEMP
Datatype: CHAR length: 6
the value we are getting is
TEMP
2X ,
SWD ,
1QER ,
What we want is
00002X,
000SWD,
001QER
Basically we want to rigth align the fields firstand then replace the
spaces by zeros.
Regards,
Pioneer 5 13468
Pioneer wrote: Hi,
column nme: TEMP Datatype: CHAR length: 6
the value we are getting is
TEMP 2X , SWD , 1QER ,
What we want is
00002X, 000SWD, 001QER
Basically we want to rigth align the fields firstand then replace the spaces by zeros.
Have a look at the REPEAT, CONCAT, and LENGTH functions.
--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Pioneer wrote: Hi,
column nme: TEMP Datatype: CHAR length: 6
the value we are getting is
TEMP 2X , SWD , 1QER ,
What we want is
00002X, 000SWD, 001QER
Basically we want to rigth align the fields firstand then replace the spaces by zeros.
Thsi should do:
SUBSTR((SUBSTR('000000', 1, 6 - LENGTH(RTRIM(TEMP)))) || TEMP, 1, 6)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
DB2 UDB for Linux, Unix, Windows
IBM Toronto Lab
This should work:
RIGHT('000000'||RTRIM(CHAR(your_column_here)),6)
This will work:
RIGHT('000000'||RTRIM(CHAR('XXX')),6)
Vijayk
Pioneer wrote: Hi,
column nme: TEMP Datatype: CHAR length: 6
the value we are getting is
TEMP 2X , SWD , 1QER ,
What we want is
00002X, 000SWD, 001QER
Basically we want to rigth align the fields firstand then replace the spaces by zeros.
Regards, Pioneer
There's lots of ways of doing this:
select temp,substr(right('000000' concat rtrim(temp),6),1,6) from t1
select temp,right('000000' concat rtrim(temp),6) from t1
Excluding the first column of the output; the first yields a 6 byte
result column. The second outputs 6 bytes for each row but the 6 bytes
is in a 4k varchar column, the length of the output of the right
function. If you run these through the command prompt, then the second
will output 4k long rows.
Phil Sherman
Pioneer wrote: Hi,
column nme: TEMP Datatype: CHAR length: 6
the value we are getting is
TEMP 2X , SWD , 1QER ,
What we want is
00002X, 000SWD, 001QER
Basically we want to rigth align the fields firstand then replace the spaces by zeros.
Regards, Pioneer This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: praba kar |
last post by:
Dear all,
Is it possible to right align
the Ipaddress? Normally we can
right align the list of numbers
by %3u or %7u. How we can right
align the Ipaddress?
I expects below format output...
|
by: Markus Mueller |
last post by:
Hi,
I'm using a form with a bunch of input tags to enter numbers. Is there any
way to make the input field right adjusted, so that the numbers align at the
right side instead of the left? Even...
|
by: kai |
last post by:
Hi, All
When I place a label on a Web form, label text is always left align, I
cannot find the property to set right align. Any way to set align property
for the label text to right align?
...
|
by: Wardeaux |
last post by:
I need to right align the text in a textbox (or label) in my ASP.NET app...
Any clues best way to accomplish this?
MTIA
wardeaux
|
by: Hans Kesting |
last post by:
Hi,
Can I right-align a number with leading *spaces*?
F.i. I have the value 2 and I want to display it as " 2".
int num = 2;
string s = num.ToString("00"); // gives "02", but I don't want the...
|
by: Steve Swift |
last post by:
If it is possible, could someone demonstrate how to make the text
entered into an <INPUT TYPE=TEXTfield right-align within the entry
field, please?
The fields in my form are for numbers, and...
|
by: nk215 |
last post by:
Hello
I have a regular expression question.
Here's what I want to do
change
TEST RADIUS 123.254
to
TEST RADIUS 3.25
|
by: David Greenberg |
last post by:
Hi
I have a character field (char ot varchar) that I want to force only to
contain numeric characters.
Can that be done by way of defining a constraint on the field ?
or by any other way in the...
|
by: Indrajit Chakraborty |
last post by:
I am developing a simple web site in ASP. I have a web page which has a form, and I want to set the values of two text box to 2 fields selected by a query. One of the fields is a name field which has...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |