db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Palmatier <cobrac...@yahoo.com>
Subject Re: LABEL ON functionality in Derby?
Date Wed, 19 Jan 2005 16:42:33 GMT
Hi Rajesh,

   The select isn't what I'm looking for in this case.
 I'm trying to create a table and then set the value
that would be returned by the ResultSetMetaData call
getColumnLabel():

ResultSet rs = stmt.executeQuery("SELECT COLUMN1,
USERNAME FROM myTable");
ResultSetMetaData rsmd = rs.getMetaData();
int numberCols = rsmd.getColumnCount();
for(int i=0; i<numberCols; i++)
{
   System.out.println("Column " + i + " Label: " 
      + rsmd.getColumnLabel(i); 
}

This usually returns a String that can be used for the
human readable column heading when a table's contents
are displayed.  After you execute a CREATE TABLE
statement you would follow it with a 

LABEL ON COLUMN myTable
(
   COLUMN1     is    'The First Column',
   COLUMN2     is    'The Second Column',
   USERNAME    is    'User Name',
   PASSWORD    is    'User Password'
);

This would set the labels for the specified columns in
the table "myTable" (this is DB2 syntax on an
iSeries).  I didn't find the LABEL ON command in the
Derby Reference manual so I was wondering if there was
another way to do this in Derby.  Does that make
sense?

Thanks for the reply,
Jason

--- Rajesh Kartha <kartha@Source-Zone.Org> wrote:

> Hi,
> 
> Is  'Select  <col> as from <table>' , what you are
> looking for.
> 
> The schema:
> --------------
> ij> select * from atab;
> ID         |COL1|COL2
> ---------------------
> 1          |CA  |MI
> 
> 1 row selected
> 
> Using the 'select as'
> ------------------------
> 
> ij> select id as IDENT_NUM from atab;
> IDENT_NUM
> -----------
> 1
> 
> 1 row selected
> 
> 
> -Rajesh
> 
> 
> Jason Palmatier wrote:
> 
> >Does Derby support anything like LABEL ON which
> allows
> >you to set the label (i.e. a displayable name) for
> a
> >column after a table is created?  I checked the
> >reference manual and it doesn't seem to but I
> wanted
> >to ask here to be sure.
> >
> >Thanks,
> >Jason
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
> >  
> >
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

Mime
View raw message