If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Db2 Stored Procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-03, 12:04
gsinha gsinha is offline
Registered User
 
Join Date: Oct 2003
Posts: 10
Db2 Stored Procedure

Hi

I am pretty new to Db2 Stored procedure and would like to have any help in this regard

I am writing an outbound script to extact data from Db2 tables to a flat file.

The Db2 column name is COUNT VARCHAR 5

The output colum name is COUNT1 with VARCHAR 7

so if the value of the COUNT is 234

I want in the output column COUNT1 the value of 0000234 as it always has to be output with length 7 digits

If the value of count is 2345 the value in the output column COUNT1 will be 0002345 meaning i will have to add 000 to make the Column COUNT1 of length 7 always

Can any one write the SQL Syntax for this please

Thanks

Gautam S
Reply With Quote
  #2 (permalink)  
Old 12-03-03, 12:22
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Something like...

right('0000000'||count1, 7)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On