Ok, I have a solution for my first question. I am sure there must be a better way to do this, but this is what I've got so far:
Exec dbo.upObjectQuickDrop
@ObjectName = 'TempDataHolder'
,@ObjectType = 'Table'
,@Schema = 'TempDB';
Go
With CTE
(NestRowNumber
,rvlPropertyID)
As
(Select Row_Number() Over(Order By rvlPropertyID)
,rvlPropertyID
From dbo.rvlPropertyStatus)
Select Max(NestRowNumber) As RowNumber
,rvlPropertyID
Into #TempDataHolder
From CTE
Group By rvlPropertyID
Order By rvlPropertyID;
Go
Exec dbo.upObjectQuickDrop
@ObjectName = 'TempResultsSet'
,@ObjectType = 'Table'
,@Schema = 'TempDB';
Go
Select (Row_Number() Over(Order By rvlPropertyID)) As RowNumber
,PropertyStatusDate
,comments
,rmVvlPropertyStatus
,rvlPropertyStatus.rvlpropertyid
,rvlPropertyStatusID
Into #TempResultsSet
From dbo.rvlPropertyStatus
Select TRS.RowNumber
,PropertyStatusDate
,comments
,rmVvlPropertyStatus
,TRS.rvlPropertyID
,rvlPropertyStatusID
From #TempResultsSet TRS Inner Join #TempDataHolder TDH
On TRS.rvlPropertyID = TDH.rvlPropertyID
And TRS.RowNumber = TDH.RowNumber
Any thoughts? Any ideas where I may be overlooking a potential logic bomb?
[font="Arial"]“Any fool can know. The point is to understand.”
- Albert Einstein
"DOH!"
- Homer Simpson[/font]