Bases de Datos > SQL Server

 Equivalente A Limit

(1/4) > >>

lencho:
En MySQL existe la funcion LIMIT, que sirve para limitar el numero de registros que uno quiere ver en una seleccion.
Alguien sabe cual es su equivalente en SQL SERVER ??

BYTE.

ElNapster:

--- Código: Text ---Select TOP 5 *              From tu_tabla 
Espero te sirva....  ;)

 :comp:

lencho:
si eso sirve de algo.

pero en realidad con eso se puede obtener:
los primeros 5 registros.
los primeros 10 registros.
.
.
los primeros N registros.

y no asi:

los segundos N registros como lo hace LIMIT.


GRACIAS.

BYTE.

ElNapster:
MMMMMM ose lo que vos queres es que te aparezcan los primeros 5 luego otros 5 como que si tuviesen tiempo de espera para que se muestren ?
 :unsure:

lencho:
exacto


googleando por ahi me encontre con esto.


--- Código: Text --- Returning only the first N records in a SQL query differs quite a bit between database platforms. Here's some samples: Microsoft SQL Server SELECT TOP 10 column FROM table PostgreSQL and MySQL SELECT column FROM tableLIMIT 10 Oracle SELECT column FROM tableWHERE ROWNUM <= 10 Sybase SET rowcount 10SELECT column FROM table Firebird SELECT FIRST 10 column FROM table Due to these differences if you want to keep your code database independent you should use the maxrows attribute in the cfquery tag in ColdFusion. The tradeoffs to database independance is performance, I would expect maxrows to be slower than specifying the rows in the SQL. <cfquery datasource="#ds#" maxrows="10">SELECT column FROM table</cfquery> PostgreSQL and MySQL have a cool feature that will let you return an arbitrary range of rows (eg return rows 10-20). This is very handy for displaying pages of records: SELECT column FROM tableLIMIT 10 OFFSET 20  
Al parecer no se puede hacer lo que quiero en SQL Server.

pero seguire intentando.

BYTE.

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

Ir a la versión completa