Andreas Ernst wrote:
> 
> Sven Koehler schrieb:
> 
> >> So i drop the primary key
> >> alter table server_gruppen drop primary key
> >>
> >> and added ( the old and the new)
> >> alter table server_gruppen add primary key (nr,server)
> >>
> >> Maybe, Elke, you about this, i think to add a primary key to an 
> >> existing primary key should work.
> >> I think it will be nicer to do this in one step instead of 
> two...;-))))
> >
> >
> > A key connot be altered - only dropped and re-created.
> > That doesn't apply to primary keys only, but also to unique 
> or normal 
> > indexes.
> >
> > the two statements:
> >   alter table server_gruppen add primary key (nr)
> >   alter table server_gruppen add primary key (server)
> > have a different meaning than
> >   alter table server_gruppen add primary key (nr,server)
> >
> > the first two statements create _two_ keys of one column each
> > the third statement creates _one_ key of _two_ columns
> >
> > I don't agree with you to include support for "adding a 
> primary key to 
> > another". That doesn make any sense. 
> 
> This did not know, sure this don't make sense.
> 
> >
> >
> > Are you sure you didn't mean
> >   create unique index server on table(server)
> > instead of
> >   alter table server_gruppen add primary key (server)
> > ??
> >
> yes, i needed two primary key

If you want to assure that column nr alone is unique 
AND that column server alone is unique, both columns may have a unique index
for them (each alone) or one may be the primary key and the other
has to have a unique index.

If you want that the combination of no and server is unique (with perhaps
several rows having the same no OR (exclusive or) having the same server)
you can specifiy a primary key (no, server)   or   a primary key (server, no)
or specify a unique index with one of the above sequences.

Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to