I need your help with a concept I want to show developers, that concept is to help them understand how SQL Server retrieves data from the table. In the event that a developer does not use a clustered index on a table I want to be able to show them the RID (Row Identification number) SQL Server uses to find the record. So my question is in a select statement how do you return the RID?
I know that you can use the following to find where SQL Server stores the data in the data file.
SELECT TOP(100) sys.fn_PhysLocFormatter(%%physloc%%) AS [File:Page:Slot], * FROM [dbo].[Badges] ;
SELECT TOP(100) * FROM [dbo].[Badges] CROSS APPLY sys.fn_PhysLocCracker(%%physloc%%);
My question is in a select statement how do you return the RID along with the table data?
Go to Source
Author: Andy Eggers