[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Rownun under msql

Posted on 1999-11-03
1
Medium Priority
?
458 Views
Last Modified: 2012-06-21
What is equivalence  rownum(oracle) under MSql ?

Thanks
0
Comment
Question by:zoltix
1 Comment
 
LVL 8

Accepted Solution

by:
chigrik earned 150 total points
ID: 2179485
If you want to receive only 10 top rows (for example) from pubs.authors table,
you may do the following:

1. For version 6.5:

   set rowcount 10
   select * from pubs.dbo.authors

   This brief description on T-SQL:
"SET ROWCOUNT number
Causes SQL Server to stop processing the query after the specified number
of rows are returned. To turn this option off (so that all rows are returned),
use SET ROWCOUNT 0."

2. For version 7.0:

   select top 10 * from pubs.dbo.authors

   This brief description on T-SQL:
"TOP n [PERCENT]
Specifies that only the first n rows are to be output from the query
result set. If PERCENT is also specified, only the first n percent of
the rows are output from the result set. When specified with PERCENT,
n must be an integer between 0 and 100."
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question