May 15, 2012 at 9:58 pm
My date table has all 366 dates of year 2008.suppose a date is deleted from the date table ,for instance.
04-01-2008,I have written a store proceure which adds the deleted dates back to the table,but those records will be added after the existing records that is after 31-12-2008.How do i add the deleted date back in order?
May 15, 2012 at 10:05 pm
The order in which data is stored is not important.
While SELECTing you have to specify ORDER BY clause and retrieve the data in the required order.
May 15, 2012 at 10:14 pm
Iam aware of the order by clause,wanted to know if there is a way to get those in order while inserting.Many did tell me that its of no importance,still thought it would be nice to know if there is a way to it.Anyways thank you for the reply Suresh.
May 16, 2012 at 12:30 am
Create a clustered index on the date column. So the data pages are arranged on the order you want. . But there is no guarantee to see the order of the data inserted using select statement. Always to get the order of the way you want, you have to use order clause in your query.
May 16, 2012 at 1:26 am
A table has no definition of order, it's an unordered set. Hence there's no concept of inserting a row into a particular place.
Even a clustered index just imposes a logical order to the way the table is stored, it doesn't give the table an order.
What problem is the insert causing that you want to insert the new row in a specific place?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 17, 2012 at 3:32 am
THX guys!! appreicate all the replies...
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply