|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Working with Integer data type |
« View previous topic :: View next topic » |
Author |
Message
|
datspats |
Posted: Sun May 06, 2007 9:37 pm Post subject: Working with Integer data type |
|
|
Voyager
Joined: 12 Apr 2007 Posts: 80 Location: Mumbai
|
Hi,
I am getting integer from DB and storing this to an integer variable in eSQL.
But i need fixed size of the integer say 5,
e.g. If the op from db is 23, I need this to be 00023
or if the op from db is 2345, then i need 02345.
I tried assigning to decimal(5,0), but leading zeros are always trimmed out, Is there any ways apart from manually prefixing zeros as string?
regards, |
|
Back to top |
|
 |
Mensch |
Posted: Sun May 06, 2007 9:58 pm Post subject: |
|
|
Disciple
Joined: 17 Jul 2005 Posts: 166
|
Best way is to write ESQL code depending upon length of the field that you are fetching from database.
OR
if you are using TDS messages, in physical properties of elements
select
Justification as "Right Justify" and Padding character as "'0'"
not sure about second option but you can give it a try
 _________________ Thanks and Regards ,
Mensch |
|
Back to top |
|
 |
elvis_gn |
Posted: Sun May 06, 2007 11:16 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi datspats,
Not tested
Code: |
RIGHT('00000' || fieldValue, 5) |
Regards. |
|
Back to top |
|
 |
AkankshA |
Posted: Mon May 07, 2007 12:39 am Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
elvis.. it would work
The fieldValue variable must be be of the CHARACTER and aso don forget to cast the o/p back to integer _________________ Cheers |
|
Back to top |
|
 |
datspats |
Posted: Mon May 07, 2007 9:58 pm Post subject: |
|
|
Voyager
Joined: 12 Apr 2007 Posts: 80 Location: Mumbai
|
Hi elvis,
Thanks for solution, that worked and this need to be casted back to int
regards |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|