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 > Sort Data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-21-09, 19:57
anushka12 anushka12 is offline
Registered User
 
Join Date: Sep 2009
Posts: 6
Sort Data

Hello Friends,
I have written a sql query to bring the output in unix.
The query is :
select tabname,tabschema,colname from syscat.columns where typename='date' and colname like '%date%'"

I am trying to place this output in excel sheet and there are some 1500 rows I have ,all of which are unsorted.

Can anybody suggest or tune the query so that the output is in an organised manner?
Reply With Quote
  #2 (permalink)  
Old 10-21-09, 20:05
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
select tabschema, tabname, colname
from syscat.columns
where typename= 'DATE' and colname like '%DATE%'
order by tabschema, tabname, colno


I assume you used caps for the literals instead of the lc in your post.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 10-21-09, 20:14
anushka12 anushka12 is offline
Registered User
 
Join Date: Sep 2009
Posts: 6
Thanks Marcus

But when I export this data into an excel sheet I see lot of spaces.I have like
1500+ rows and I am trying to have the data like a table in excel sheet.Will the query you suggested give me the desired result?
Reply With Quote
  #4 (permalink)  
Old 10-21-09, 21:20
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
db2 "export to date_column.txt of del select tabschema, tabname, colname from syscat.columns where typename= 'DATE' and colname like '%DATE%' order by tabschema, tabname, colno"

Then open date_column.txt with Excel (you have to select txt files as input), and select "space" as the delimiter.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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