SQL: Using the TOP command
The TOP keyword allwos you to return the first 'n' number of rows from a query. In SQL 2005, TOP can be used to return percentage of the rows for the query.
Here is an example:
DECLARE @Percentage float
SET @Percentage = 10
SELECT TOP(@Percentage) PERCENT
Name
FROM Company.Employee
ORDER BY Name
GetTechieHere..
Here is an example:
DECLARE @Percentage float
SET @Percentage = 10
SELECT TOP(@Percentage) PERCENT
Name
FROM Company.Employee
ORDER BY Name
GetTechieHere..
0 Comments:
Post a Comment
<< Home