Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
order ic change at the time of insert
Old 03-16-2007, 06:38 AM order ic change at the time of insert
Novice Talker

Posts: 4
Trades: 0
I am facing some problem related to sequencing
I have original table and one temp table
original table is as follow
Key Name value
63871 Reimburse Amt
63871 Flat Rate 11
63871 Process Rule
63872 ASC DRG Code
63872 MDC Code
63872 DRG Reim Amt
63872 Reim Base Type
63872 Reim Base Value
63872 DRG Outlier Amt
63872 HIS Reimburse Pct 11
when I am trying to insert the above records in temp table
then it is entering the Name in Ascending order.
like as follow
tempkey tempname tempvalue
63871 Flat Rate 11
63871 Process Rule
63871 Reimburse Amt
63872 ASC DRG Code
63872 DRG Outlier Amt
63872 DRG Reim Amt
63872 HIS Reimburse Pct 11
63872 MDC Code
63872 Reim Base Type
63872 Reim Base Value

I don't want ascending order.
I want same data like Original table in temp table.
I am useing following query
insert into temptable
select * from originaltable

Please tell me how I can maintain the sequence at the time of inserting the data.
shubhada99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-16-2007, 02:37 PM Re: order ic change at the time of insert
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Data is stored in your table in no particular order. The exact mechanics depend on your database, but because of caching and everything else the db does, and because of the way relational theory works, there's no "natural order" and data normally isn't stored in the order you enter it. The order the records come in makes no difference under relational theory.

So if you have your own reasons to keep the records in a particular order, well, presently you don't have a mechanism for that. You have a bunch of numbers that are duplicated. And then you have some text. Those are the two things available for the database engine to sort your data on in your select query. ( Even with no order by clause, one is implied by your table and index definition. )

It sounds like what you want to do is add an identity column, before adding the new data. An identity data type is one managed and generated by the server, that typically goes like this: 1, 2, 3, 4, 5, and so on. Usually people use them to create a single, unique value that any row can be identified by, but for what you're trying to do, they're also a good tool.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to order ic change at the time of insert
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10437 seconds with 12 queries