Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
stalinbtech
Starting Member
1 Post |
Posted - 2009-04-18 : 06:26:03
|
Dear Friends, 1. I Created a temp table.Create Table #TempTable( ID Int Identity(1,1), PartNumber Varchar(18), Priority Int)2. Inserting the values in ascending order of the part number.Insert Into #TempTable(PartNumber ,Priority)Select PartNumber,Priority From PartDetails With (NoLock)Order By PartNumber Asc3. Selecting the records.Select * From #TempTableIf the table is having less data, it returning the same order of the partnumber as i inserted.But if records are more, the result set order is changing.My Question is that, Will temporary table keep the data in the same order as we inserted?. In my case, it is not doing so. Thanks for all your time for this thread.Advance Thanks & Regards,Stalin |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-18 : 06:40:16
|
The ONLY guaranteed way to displayed your records in a specific order is to use ORDER BY.You can't rely on clustered index nor any other technique other than ORDER BY.Select * From #TempTable ORDER BY PartNumber E 12°55'05.63"N 56°04'39.26" |
|
|
|
|
|