Hola, yo directamente ni lo usaria porque es por conexion y no sabes si en ese interin no puede venir otra consulta y no dar los resultados reales
Te copio lo que dicen los BOL al respecto:
 
Remarks

It is recommended that DELETE, INSERT, and UPDATE statements currently using SET ROWCOUNT be rewritten to use the TOP syntax. For more information, see DELETE, INSERT, or UPDATE.

The setting of the SET ROWCOUNT option is ignored for INSERT, UPDATE, and DELETE statements against remote tables and local and remote partitioned views.

To turn this option off (so that all rows are returned), specify SET ROWCOUNT 0.

Note  Setting the SET ROWCOUNT option causes most Transact-SQL statements to stop processing when they have been affected by the specified number of rows. This includes triggers and data modification statements such as INSERT, UPDATE, and DELETE. The ROWCOUNT option has no effect on dynamic cursors, but it limits the rowset of keyset and insensitive cursors. This option should be used with caution and primarily with the SELECT statement.

SET ROWCOUNT overrides the SELECT statement TOP keyword if the rowcount is the smaller value.

The setting of SET ROWCOUNT is set at execute or run time and not at parse time.



 
El día 9/10/06, German GOYENECHE <[EMAIL PROTECTED]> escribió:

Asi es, hay que tener cuidado con eso, siempre hay que poner el ROWCOUNT 0 al final para volver a la normalidad

 


De: [email protected] [mailto:[email protected]] En nombre de Maxi Accotto
Enviado el: Lunes, 09 de Octubre de 2006 03:44 p.m.
Para: dbms List Member
Asunto: [dbms] Tomar solo los primero 20 registros de una consulta SQL

 

Hola, ojo con el Rowcount, no es aconsejable su uso, fijate que es por conexion y si no lo llegaras a sacar podrias hacer un lio tremendo :S

El día 9/10/06, German GOYENECHE < [EMAIL PROTECTED]> escribió:

Julian, para que te devuelva los primero 20 registros podes hacer:

SELECT

            TOP 20

            *

FROM

            TABLA

 

O tambien lo que podes hacer es

 

SET ROWCOUNT 20

SELECT

            *

FROM

            TABLA

SET ROWCOUNT 0

 


De: [email protected] [mailto:[email protected]] En nombre de Julian Berlin
Enviado el: Lunes, 09 de Octubre de 2006 02:27 p.m.
Para: dbms List Member
Asunto: [dbms] Tomar solo los primero 20 registros de una consulta SQL

 

Hola Gente !

Voy a hacer una consulta muy basica sobre SQL…alguien tiene idea como podar el resultado de una query …osea que solo me devuelva

Por ejemplo los 20 primeros registros ?

Saludos y desde ya muchas gracias

 

Julián R Berlín
Hexacta S.A.
tel. +54 11 4779 6326.
Andrés Arguibel 2860.
Buenos Aires, Argentina.

 

Este mensaje electrónico y todos los archivos adjuntos que contiene son confidenciales y se encuentran destinados, exclusivamente, a la persona a quien han sido dirigidos. Si ha recibido este mensaje por error, agradecemos la inmediata devolución a su emisor. La publicación, el uso, la distribución, la impresión o la copia no autorizada de este mensaje y del contenido de los archivos adjuntos se encuentran estrictamente prohibidos.

 

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

 

Ce message électronique et tous les fichiers attachés qu'il contient sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le retourner à son émetteur. La publication, l'usage, la distribution, l'impression ou la copie non autorisée de ce message et des attachements qu'il contient sont strictement interdits.




--
----------------------------------------------------
Microsoft MVP (Most Valuable Professional) SQL Server
Orador Culminis
( www.sqlgurus.org)
-------------------------------------------

Este mensaje electrónico y todos los archivos adjuntos que contiene son confidenciales y se encuentran destinados, exclusivamente, a la persona a quien han sido dirigidos. Si ha recibido este mensaje por error, agradecemos la inmediata devolución a su emisor. La publicación, el uso, la distribución, la impresión o la copia no autorizada de este mensaje y del contenido de los archivos adjuntos se encuentran estrictamente prohibidos.
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.
Ce message électronique et tous les fichiers attachés qu'il contient sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le retourner à son émetteur. La publication, l'usage, la distribution, l'impression ou la copie non autorisée de ce message et des attachements qu'il contient sont strictement interdits.



--
----------------------------------------------------
Microsoft MVP (Most Valuable Professional) SQL Server
Orador Culminis
( www.sqlgurus.org)
-------------------------------------------

Responder a