Consider the following sql server query ,
DECLARE @Table TABLE(
Wages FLOAT
)
INSERT INTO @Table SELECT 20000
INSERT INTO @Table SELECT 15000
INSERT INTO @Table SELECT 10000
INSERT INTO @Table SELECT 45000
INSERT INTO @Table SELECT 50000
SELECT *
FROM (
SELECT *,
ROW_NUMBER() OVER(ORDER BY Wages DESC) RowID
FROM @Table
) sub
WHERE RowID = 3
The result of the query would be 20000
..... Thats fine as of now i have to find the result of this query,
SELECT *
FROM (
SELECT *,
ROW_NUMBER() OVER(ORDER BY Wages DESC) RowID
FROM @Table
) sub
WHERE RowID = 6
It will not give any result because there are only 5
rows in the table.....
so now my question is
What is the easiest way to find a sql query returns a result or not?