Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

primary key

Former Member
0 Likes
597

Hi frnds

I am having a custom table with primary key field A, this program is used by many programs based on the primary key and they are in production. Now my requirement is I need to add new field to the table which should be unique.

1. what should i do in this case to create a new field?

2. Does creating secondary index will solve my problem?

3. If i create a new field with secondary index with unique key. Can i modify or delete a record based on the secodary index in my new program which i am going to write?. I mean my question is can we modify primary key based on the secondary key?

3 Is there any way other than secondary index?

Thanks in advance

4 REPLIES 4
Read only

Former Member
0 Likes
551

The concept of Primary Key and Secondary Index are different.

->when u r fetching data from from data base , in the select query to make fast retrival we use primary keys in selection if we useing fields other than primary keys fetching time is slow compartively using primary keys , so we will make/create the non-primary key fields as Secondary Index to make fast retrival...

-> primary keys to make unique records in data base.

so u have to decide weather you require extra field (one more field in primary keys) which will not effect another programs...then u can add...

Ramesh.

Read only

Former Member
0 Likes
551

forget indexes...those are used only for accessing data fast...

nw u hav to add ur new field in the primary key ... for this just add a new field in the primary key are ...but u hav to change ur proogram too accordingly .. it miet give u an error...plz. look into the program too after chaging the table

hope this will help

bbye tc

Ashwani

Read only

0 Likes
551

my question i am having a primary key in the table. now i want to add another field to the table and that should be unique. So based on this unique key value can i modify the primary key value.

for example can i delete the record based on the secondary unique value

and can i modify the record(including primary key value) based on the secondary unique value

Read only

0 Likes
551

oh yes you can

it doesnt even have to be uinque, tho in that case he´s doing your modifications to the first recors matching the requirements.

so yeah it will work but make sure the values in your appended field are really unique.