As has been mentioned many times, taking the top (any number) of a
table/recordset in SQL will get you almost certainly 20 random records.
If you have somehow tagged the records with an incrementing id field you
could sort your recordset first by that field and take your top 20 from
that. But from your previous queries on this kind of thing I think your
data probably isn't tagged this way.
Regards
David Postlethwaite
The Bank of New York
London SecLend UK IT
Tel: (0)207 964 6855
Email: [Email address protected]
|---------+-------------------------------------------------------->
| | "Biswaranjan Rath " |
| | <mssqldba-ezmlmshield-x16143881.[Email Address Removed] | azyDBA.com> |
| | |
| | 29/07/2004 06:34 |
| | |
|---------+-------------------------------------------------------->
>----------------------------------------------------------------------------------------------|
| |
| To: "LazyDBA Discussion" <[Email address protected] |
| cc: |
| Subject: Urgent: Regarding use of top |
>----------------------------------------------------------------------------------------------|
I have a SQL query like:
UPDATE EMP SET SAL=3500
WHERE ROWNUM <= 20 AND ENAME LIKE '%s%';
Can anybody help me out by giving suggestion about the equivalent
statement in T-SQL (SQL Server) ?
With best regards
Biswaranjan Rath
Subject Matter Expert
Amdocs DVCI, Pune, India
Phone : +91-20-4048951 Extn.: 302(Office)
+91-20-4062302 (Direct)
-------------------------------------------------------------------------------------
The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated
recipient(s)
of the message. If the reader of this message is not the intended
recipient,
you are hereby notified that any dissemination, use, distribution or
copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us
immediately
by replying to the message and deleting it from your computer.
Thank you.
---------------------------------------------------------
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]
________________________________________________________________________
The information in this e-mail, and any attachment therein, is confidential and for use by the addressee only. If you are not the intended recipient, please return the e-mail to the sender and delete it from your computer. Although The Bank of New York attempts to sweep e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses.
MS Sql Server LazyDBA home page