Monday, March 26, 2012

return @count rows from SP

Is there a way to limit the number of rows returned by a SP, where the limit
is a @.parameter?
Similarly, can the next x rows be returned by passing a @.startIndex and
@.Count?
I can see how it could be achieved with a IDENTITY column, but only if not
deletes occur. Otherwise, I am at a loss.
Thanks
--== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==-
--
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
--= East and West-Coast Server Farms - Total Privacy via Encryption =--Try this article, it will help you. The magix word is serverside Cursors.
http://www.windowsitpro.com/SQLServ...0505/40505.html
HTH, Jens Smeyer.
http://www.sqlserver2005.de
--
"David J Rose" <david.rose@.newsgroup.reply.only.com> schrieb im Newsbeitrag
news:425d0b36$1_2@.127.0.0.1...
> Is there a way to limit the number of rows returned by a SP, where the
> limit is a @.parameter?
> Similarly, can the next x rows be returned by passing a @.startIndex and
> @.Count?
> I can see how it could be achieved with a IDENTITY column, but only if not
> deletes occur. Otherwise, I am at a loss.
> Thanks
>
> --== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet
> News==--
> http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+
> Newsgroups
> --= East and West-Coast Server Farms - Total Privacy via Encryption
> =--|||Thanks, but I cannot use dynamic SQL
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:eMRe4LCQFHA.3928@.TK2MSFTNGP09.phx.gbl...
> Try this article, it will help you. The magix word is serverside Cursors.
> http://www.windowsitpro.com/SQLServ...0505/40505.html
> HTH, Jens Smeyer.
> --
> http://www.sqlserver2005.de
> --
> "David J Rose" <david.rose@.newsgroup.reply.only.com> schrieb im
> Newsbeitrag news:425d0b36$1_2@.127.0.0.1...
>
--== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==-
--
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
--= East and West-Coast Server Farms - Total Privacy via Encryption =--|||See if this helps ():
http://www.aspfaq.com/show.asp?id=2120
AMB
"David J Rose" wrote:

> Is there a way to limit the number of rows returned by a SP, where the lim
it
> is a @.parameter?
> Similarly, can the next x rows be returned by passing a @.startIndex and
> @.Count?
> I can see how it could be achieved with a IDENTITY column, but only if not
> deletes occur. Otherwise, I am at a loss.
> Thanks
>
> --== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News=
=--
> http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ N
ewsgroups
> --= East and West-Coast Server Farms - Total Privacy via Encryption =--
-
>|||OK verstehe, versuch doch mal das hier (Ergebnisse / Resultset
durchnummerieren):
http://support.microsoft.com/?kbid=186133
Wenn Du eine Spalte hast mit der Du die Suche sortieren kannst, am besten
eine die sich nicht mehr ndert und die Suchergebnisse somit verflschen
knnte, ist das die richtige Lsung.
select rank=count(*), a1.au_lname, a1.au_fname
from authors a1, authors a2
where a1.au_lname + a1.au_fname >= a2.au_lname + a2.au_fname
group by a1.au_lname, a1.au_fname
having count(*) >10
order by 1
Dabei kannst Du auch sowohl startindex als auch die Gre des Resultsets
angeben.
HTH, Jens Smeyer.
http://www.sqlserver2005.de
--
"David J Rose" <david.rose@.newsgroup.reply.only.com> schrieb im Newsbeitrag
news:425d1175$1_2@.127.0.0.1...
> Thanks, but I cannot use dynamic SQL
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:eMRe4LCQFHA.3928@.TK2MSFTNGP09.phx.gbl...
>
> --== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet
> News==--
> http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+
> Newsgroups
> --= East and West-Coast Server Farms - Total Privacy via Encryption
> =--|||Vielen Dank!
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:OUB0$aCQFHA.3628@.TK2MSFTNGP12.phx.gbl...
> OK verstehe, versuch doch mal das hier (Ergebnisse / Resultset
> durchnummerieren):
> http://support.microsoft.com/?kbid=186133
> Wenn Du eine Spalte hast mit der Du die Suche sortieren kannst, am besten
> eine die sich nicht mehr ndert und die Suchergebnisse somit verflschen
> knnte, ist das die richtige Lsung.
> select rank=count(*), a1.au_lname, a1.au_fname
> from authors a1, authors a2
> where a1.au_lname + a1.au_fname >= a2.au_lname + a2.au_fname
> group by a1.au_lname, a1.au_fname
> having count(*) >10
> order by 1
> Dabei kannst Du auch sowohl startindex als auch die Gre des Resultsets
> angeben.
>
> HTH, Jens Smeyer.
> --
> http://www.sqlserver2005.de
> --
> "David J Rose" <david.rose@.newsgroup.reply.only.com> schrieb im
> Newsbeitrag news:425d1175$1_2@.127.0.0.1...
>
--== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==-
--
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
--= East and West-Coast Server Farms - Total Privacy via Encryption =--|||Sorry, wrong ng language:
Try to num the rows (num resultsets)

> http://support.microsoft.com/?kbid=186133
If you got a column to sort, espicially one which wont change in future not
to screw up the resut from the resultset, that would be a way.
select rank=count(*), a1.au_lname, a1.au_fname
> from authors a1, authors a2
> where a1.au_lname + a1.au_fname >= a2.au_lname + a2.au_fname
> group by a1.au_lname, a1.au_fname
> having count(*) >10
> order by 1
>
Here you can pass in a starting and a paging size parameter.
HTH, Jens.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> schrieb
im Newsbeitrag news:OUB0$aCQFHA.3628@.TK2MSFTNGP12.phx.gbl...
> OK verstehe, versuch doch mal das hier (Ergebnisse / Resultset
> durchnummerieren):
> http://support.microsoft.com/?kbid=186133
> Wenn Du eine Spalte hast mit der Du die Suche sortieren kannst, am besten
> eine die sich nicht mehr ndert und die Suchergebnisse somit verflschen
> knnte, ist das die richtige Lsung.
> select rank=count(*), a1.au_lname, a1.au_fname
> from authors a1, authors a2
> where a1.au_lname + a1.au_fname >= a2.au_lname + a2.au_fname
> group by a1.au_lname, a1.au_fname
> having count(*) >10
> order by 1
> Dabei kannst Du auch sowohl startindex als auch die Gre des Resultsets
> angeben.
>
> HTH, Jens Smeyer.
> --
> http://www.sqlserver2005.de
> --
> "David J Rose" <david.rose@.newsgroup.reply.only.com> schrieb im
> Newsbeitrag news:425d1175$1_2@.127.0.0.1...
>|||It has happened to me to answer in TSQL when the poster was talking Access,
but I've never answered in French (my native language) when the poster was
talking English.
Mind you, I don't hang out in the French newsgroups.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:OWp3XkCQFHA.2356@.TK2MSFTNGP14.phx.gbl...
> Sorry, wrong ng language:
> Try to num the rows (num resultsets)
>
> If you got a column to sort, espicially one which wont change in future
> not to screw up the resut from the resultset, that would be a way.
> select rank=count(*), a1.au_lname, a1.au_fname
> Here you can pass in a starting and a paging size parameter.
> HTH, Jens.
>
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> schrieb
> im Newsbeitrag news:OUB0$aCQFHA.3628@.TK2MSFTNGP12.phx.gbl...
>

No comments:

Post a Comment