Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ALTER TABLE

Status
Not open for further replies.

Prusso

Programmer
Jul 5, 2002
13
AR
How I can put a filter expresion in a primary key with the
alter table expresion

I have an existing table with a primary key and I want to put a filter expresion without loosing data

Tank a lot
 
I do not believe that primary keys can be filtered. Attitude is Everything
 
ALTER TABLE mytable ADD PRIMARY KEY expres TAG TagName FOR condiction = whatever Attitude is Everything
 
I put this but it dosen't work

ALTER TABLE embarque ADD PRIMARY KEY nrodedestino TAG codigo FOR .NOT. DELETED()

I don't know if the filter expresion may be this ( !deleted())

 
why do you say it did not work?

I am not sure but I don't believe that you need to worry about the index tag on deleted records. once you set delete on / off will act accordly. Attitude is Everything
 
I try this but dosen't work because the validation of the primary key that I violate the unique index

I add a record with number 1, then I delete this record and add again the number 1

Sorry about my english

Thank

Pablo
 
that because it is the primary key. primary key means that you can't have any duplicates in that key.

i don't understand what you are trying to do? Attitude is Everything
 
For example

The primary key in the table is the number of telefone

So the user add a telefone number :
1234569-98
This is the first record

Then the user delete this record and then he add a new record :
telefone number
1234569-98

When he save the data the error occurs

THANK
Pablo
 
have you
SET DELETED ON
??

commands which operate on records marked for deletion are ignored.
Attitude is Everything
 
are you using table buffering, if so then when the record is deleted you need to do a tableupdate() Attitude is Everything
 
Prusso,
Your observations are right, it's your table design that's wrong. Primary keys should never be re-used, and it's really not important that they be "meaningful". For a good discussion on Primary Keys, see the article of the same name at
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top