473,836 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5155

"t53864" <t5****@yahoo.c om> wrote in message
news:9e******** *************** ***@posting.goo gle.com...
| 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@Xenqu ery .com> wrote in message news:<T9******* *************@c omcast.com>...
"t53864" <t5****@yahoo.c om> wrote in message
news:9e******** *************** ***@posting.goo gle.com...
| 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
5175
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, show them, edit, correct, insert, etc. It's done and works fine. The problem is to change the order of these records using a simple renumbering of this ORDER_BY column directly in a dataset. It's only one
3
8135
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 side? thanks
1
3920
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 reorder columns. Can anyone confirm? Thanks you in advance. Mat
0
1278
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 I wanted reorder is automatically send to the end of the listview... :(( Has someone got the same problem ??? Thanks in advance for your help
2
3312
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. I would like to reorder the English text instead the Hebrew text. How can I do that please?
0
2164
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 checkboxes switches position with the middle column(there are five columns in the listview)? Thank you in advance, D.
4
6130
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, ProductName, SupplierID, UnitsInStock, ReorderLevel from Products where (UnitsInStock < ReorderLevel) Results: ProductID ProductName SupplierID UnitsInStock ReorderLevel
3
1976
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> The order is author, id, title, length. I NEED to reorder to any I want title, author, length, id. When it reads in via javascript and each <childelement> is formatted via CSS using relative styling its is shows up incorrectly. I need to...
1
380
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
9826
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10860
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10261
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6984
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5831
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4466
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.