473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Reorder Primary Key - any problem?

I need to reorder the primary key of a table. Say,

Primary Key (field1, field2)

changed to:

Primary Key (field2, field1)

Would like to know if this creates any problem to the
database?
Jul 19 '05 #1
4 5111

"t53864" <t5****@yahoo.com> wrote in message
news:9e**************************@posting.google.c om...
| I need to reorder the primary key of a table. Say,
|
| Primary Key (field1, field2)
|
| changed to:
|
| Primary Key (field2, field1)
|
| Would like to know if this creates any problem to the
| database?

sort of -- all FKs would be dropped when the PK is dropped, and then
recreated with the new column order explicitly indicated

do a little testing to see the effects

++ mcs
Jul 19 '05 #2
t53864 wrote:
I need to reorder the primary key of a table. Say,

Primary Key (field1, field2)

changed to:

Primary Key (field2, field1)

Would like to know if this creates any problem to the
database?


Primary key index would have different column ordering. Might impact
performance depending on your queries.
Jul 19 '05 #3
"Mark C. Stock" <mcstockX@Xenquery .com> wrote in message news:<T9********************@comcast.com>...
"t53864" <t5****@yahoo.com> wrote in message
news:9e**************************@posting.google.c om...
| I need to reorder the primary key of a table. Say,
|
| Primary Key (field1, field2)
|
| changed to:
|
| Primary Key (field2, field1)
|
| Would like to know if this creates any problem to the
| database?

sort of -- all FKs would be dropped when the PK is dropped, and then
recreated with the new column order explicitly indicated

do a little testing to see the effects

++ mcs


To clarify what Mark said if you attempt to drop a PK that is
referenced by a FK Oracle will return an error and refuse to perform
the drop unless you include the cascade constraints cluase. However,
it is your responsibility to re-create the dropped FK references.
Oracle does not automatically restore them in versions 7.0 - 9.2, and
I doubt that this has changed with 10g.

If there are no FK references to the PK then this is not a
consideration.

HTH -- Mark D Powell --
Jul 19 '05 #4
>[Case1] Primary Key (field1, field2)
index for (field1, field2) or (field2, field1) or *(field1)*.
[Case2] Primary Key (field2, field1)

index for (field1, field2) or (field2, field1) or *(field2)*.
so, If you query with condition (field1, field2) <- order doesn't matter
[Case1] and [Case2] should be the same, I think.

In case query with (field1) or (field2) only,
only [Case1] or [Case2] will be available.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dmitri Shvetsov | last post by:
Hi, I'm working with the MSSQL 2000 and C#. When I load my data from the database table in a DataSet I use the query to order all records by some column. Then I can work with these records,...
3
by: CodeRazor | last post by:
Is it possible to reorder items in a listbox server control by having the user select an item and then click an up or down button? ... how? Or is this something that can only be achieved client...
1
by: Mat | last post by:
Reordering Column changes column Indexes???? i use column.index to access(or add ) data in listview. i want to allow user to reorder columns as they need. So i am afraid to get wrong data when user...
0
by: uv507 | last post by:
Hello, I have found a way to easily reorder rows of my listview. But it only works in small icons mode. When I do my reordering (drag and drop in my own list) in large icons mode, the item that...
2
by: Asaf | last post by:
Hi, Below is a calss with function I gathered from a news group that uses GetCharacterPlacement API to reorder text. I have mixed text Hebrew/English and the function reorders the Hebrew text. ...
0
by: daju | last post by:
hello My question is, after we allow the column reorder can we modify the order of columns through our code. What I need to do is reorder the listview columns so the first column with the...
4
by: rdraider | last post by:
Use the Northwind database Products table as an example. Purchasing dept gets a report showing when inventory items on hand qty are below the reorder level. easy enough: Select ProductID,...
3
by: done4who | last post by:
Heres my problem: my javacript code reads each child element e.g.: <video> <author>skateboard2</author><id>xqWBGvbvw7g</id><title>zach skating</title><length_seconds>100</length_seconds></video>...
1
by: t53864 | last post by:
I need to reorder the primary key of a table. Say, Primary Key (field1, field2) changed to: Primary Key (field2, field1) Would like to know if this creates any problem to the database?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.