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 > Exporting dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-15-04, 05:40
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Question Exporting dates

AIX 5.2 DB2 8.1.4

Hi guys

I'm trying to export database tables to positional files
which works well with alle character and numerical values
But any attempt to concatenate dates results in error:

--x--

EXPORT TO "u:\mdr.txt" OF DEL MESSAGES "u:\mdr.log"

SELECT (A.d_anmdato)||(a.d_koncdato)

FROM mdr.t_aflv04 A

--x--

The select by itself reports:


com.ibm.db.DataException: Der er
opstået en fejl i databasesystemet. : [IBM][CLI
Driver][DB2/6000] SQL0440N No authorized routine named "||" of
type "FUNCTION" having compatible arguments was found.
SQLSTATE=42884


Does anyone know a workaround?

Cheers
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #2 (permalink)  
Old 06-15-04, 05:41
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
char(date1)||char(date2)
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 06-15-04, 05:46
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Arrow Iso

Thanks Sathyaram

The only problem with this approach is that it superseeds
the default settings on the export utility and returns the
dates in dd-mm-yyyy instead of ISO which I require.

Do I really have to cut the date to pieces and string it together?

Cheers
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #4 (permalink)  
Old 06-15-04, 07:01
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have you tried using modified by datesiso ..

If this does not work with char(date1) then you can try using CTE (Not tested, but you can give a try)

export to file1.del of del
modified by datesiso
with temp as
(
select date1,date2 from table1
)
select char(date1)||char(date2) from temp
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 06-15-04, 09:36
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
If you RTFM to look up the definition of the CHAR function you'll see that it allows you to specify date string format, something like this:
Code:
char(date1, ISO)
Reply With Quote
  #6 (permalink)  
Old 06-16-04, 03:35
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Thumbs up Dateiso

Hey n_i

I did just that and it worked, though i still had to cut
out the '-''s afterwards - Thanks both.

Cheers
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health

Last edited by Tank; 06-20-04 at 15:04. Reason: Found solution
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