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 > How to Include a Forward Slash on a column value in Select Statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-10, 12:23
HanNew2DB2 HanNew2DB2 is offline
Registered User
 
Join Date: Sep 2010
Posts: 17
How to Include a Forward Slash on a column value in Select Statement

Hi,
Column named Birth_MM_DD has values stored as 0807(mmdd), not sure of the data type of the column(doesn't look like a date field). When retrieving the values from the Birth_MM_DD column, i want to include a forward slash seperating the month & date - ex: 08/07..... what function to use in sql?
help please!
Han
Reply With Quote
  #2 (permalink)  
Old 09-22-10, 12:55
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
There are many ways(functions) to include slash.

If the data type of Birth_MM_DD was CHAR(4), some examples:
1) INSERT
2) TRANSLATE
3) SUBSTRs(or LEFT and RIGHT) then concatenate(||)
Reply With Quote
  #3 (permalink)  
Old 09-22-10, 18:22
HanNew2DB2 HanNew2DB2 is offline
Registered User
 
Join Date: Sep 2010
Posts: 17
It worked

It worked, great....... muchos gracias!
Reply With Quote
Reply

Tags
forward slash

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