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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-04-30 : 07:32:12
|
| Daniel writes "Hi,I've read the two articles on paging recordsets, seems that SQL should have automated the process with a "range" keyword but anyways...My question: When creating the temporary table I am only including the identity field and another identity field. Then, once the temp table is populated, I do the big fancy inner joins using the temp table ID. Any comments on the performance of instead doing the big inner joins as i am populating the temp table (hence a large temp table) and then only having a simple select at the end versus small temp table. My thoughts are that it doesn't matter.Hope you can understand the question! Thanks, great site.e.g.--Create a temporary tableCREATE TABLE #TempItems( ID int IDENTITY, someID int)-- populate the temp tableinsert into #TempItems (someID)select someID from tblSome-- now i need a lot of data from different tables-- inner join with the someID (which is my starting key)-- using the TempItems.ID for the range i wantSELECT tblSome.*, tblCustomer.*, tblRoute.*, tblZone.*, tblOrders.*, tblTimeWindow.*, tblSpecialty.*, tblRouteMetric.*...INNER JOIN #TempItems on #TempItems.someID = tblSome.someIDWHERE #TempItems.ID > @l_iLowerBound and #TempItems.ID <= @l_iUpperBoundorder by #TempItems.ID" |
|
|
|
|
|
|
|