My understanding is that you have a table with an identity column (auto number) and you want to retrieve the row index for a given identity value ?
and hope this helps
WITH MyTemp AS
(
SELECT <<YOUR IDENTITY COLUMN>>,<< COLUMN 2>>,<<COLUMN 3>>
ROW_NUMBER() OVER (ORDER BY <<YOUR IDENTITY COLUMN>>) AS 'RowNumber'
FROM Orders
)
SELECT *
FROM MyTemp
where <<YOUR IDENTITY COLUMN>>=10251
folowowing is the query you can run on the SQL Server northwind database and see how it works
WITH OrderedOrders AS
(
SELECT OrderID,OrderDate,
ROW_NUMBER() OVER (ORDER BY orderid) AS 'RowNumber'
FROM Orders
)
SELECT *
FROM OrderedOrders