RE: [Maybe Spam] to append zeroes to left of a value

RE: [Maybe Spam] to append zeroes to left of a value

 

  

Try the DIGITS scalar function. You may need to substring it to get to the
required scale.

db2 => create table T1 (C1 integer) in mytspace
DB20000I The SQL command completed successfully.
db2 => insert into T1 (C1) values(1234)
DB20000I The SQL command completed successfully.
db2 => select digits(c1) from t1

1
----------
0000001234

1 record(s) selected.

db2 => select substr(digits(c1),2,9) from t1

1
---------
000001234

1 record(s) selected.
Regards
Alex

-----Original Message-----
From: Chiranjeev Mukherjee
[mailto:db2udbdba-ezmlmshield-x88653214.[Email address protected]
Sent: 28 November 2005 11:22
To: LazyDBA Discussion
Subject: [Maybe Spam] to append zeroes to left of a value


Hi gurus,

My problem is as follows:



I have a Numeric field ARTICLE_NBR of length 9.

Some of the articles are of length less than 9.

Suppose mys article no is : 123456

In my output I need it as : 000123456.



I need a query for this urgently.

Please if anyone can help me........







Regards

Chiranjeev

N

'We Stop playing not because we grow old,we grow old because we stop
playing'





---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



******************************************************
The information in this E-mail and in any attachment is
confidential and is intended solely for the addressee.
Access, copying, disclosure or use of such information
by anyone else is unauthorised. If you are not the
intended recipient please contact [Email address protected]
While reasonable efforts are made to ensure these files are free
of virus infection and offensive materials, if something of this
nature is inadvertently sent to you, please destroy it, accept
our apologies and contact [Email address protected] with
details of the sender. We will ensure that action is taken
immediately to prevent any recurrence. Debenhams accept no
responsibility for any views expressed by the originator of this email.


Debenhams Retail plc (reg. no. 83395) Registered in England and Wales.
Registered office: 1 Welbeck Street, London W1G 0AA.

http://www.debenhams.com

******************************************************


DB2 & UDB email list listserv db2-l LazyDBA home page