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

Deleting Primary Key fields

Former Member
0 Likes
5,313

Can we delete Primary Key fields of a transparent table which is already having the data in Production Server?

If Yes, could you help me out with the procedure

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,509

You can not do it in Production directly, rather u need to do in development server and transport , transport request to production.

once transport request is in production, run SE14 to adjust the database table.

Can we delete Primary Key fields of a transparent table which is already having the data in Production Server?

If Yes, could you help me out with the procedure

8 REPLIES 8
Read only

Former Member
0 Likes
3,510

You can not do it in Production directly, rather u need to do in development server and transport , transport request to production.

once transport request is in production, run SE14 to adjust the database table.

Read only

ThomasZloch
Active Contributor
0 Likes
3,509

Deleting primary key fields will most likely lead to duplicate keys, so you will lose data when adjusting the table as suggested above.

Make sure you know what you are doing, search for additional information and documentation.

Thomas

Read only

Former Member
0 Likes
3,509

Hi,

Yes you can delete pk's but one pk is mandatory and after deleting the pk u can adjust the table in tcode : SE14 without lose of data/records.

Regards

Mahesh

Read only

pankaj_sandanshi
Product and Topic Expert
Product and Topic Expert
0 Likes
3,509

Hi,

Yes you can delete the primary key  of a transparent table but you should not do it in production server

because once you delete the primary key field, system will ask you to activate and adjust the table again, you can do it through SE14 tcode by selecting activate and adjuct option, but there are chnces

of table data might be deleted.

Regards

Pankaj

Read only

Former Member
0 Likes
3,509

Hi Kalyan,

The Primary key field can be removed , also the primary key field can be deleted irrespective of the table being present in Production / Dev server.

Since, the transparent table is present in Production, it can be risky do make any major changes without proper approvals. 

Please make sure to make adjustments in Table definition from Database Utility.

Utilities - > Database Object -> Database Utility

Regards

Vivek Batta

Read only

Former Member
0 Likes
3,509

you cannot delete primary key fields of table which have data. create another table in dev, and move to production and copy data...and then delete table. Note: table name should update all objects which have used this table.

Read only

0 Likes
3,509

The way suggested above .... is a good procedure one should follow ( especially in Dev / Prod ) server.

However, I once tried deleting the primary key field in sandbox server and was able to keep the data intact after deleting the primary key field. After making the changes, the DB structure was adjusted using DB utility

I feel, there might be a difference in how we approach the scenario here.

Read only

0 Likes
3,509

In your example, you did not lose data because the combined values in the remaining primary key fields were still unique. Suppose you remove FATHER_NAME as well, then you would lose one of the two EID = "2" / ACC_NO = "112" rows after adjusting the table.

Thomas