动态排序 [英] Dynamic Sorting

查看:77
本文介绍了动态排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从存储过程动态排序结果?或者更多

重要的是,最快最有效的方法是什么?


我知道我可以在ASP的记录集中进行排序,但是AFAIK这是

不是最有效的方法。


理想情况下,我想将参数传递给SP以指示排序字段

订单...


你们怎么样这个?


谢谢


Chris


-
cj ****** *@REMOVEMEyahoo.co.uk

[删除明显的位]

How can I dynamically sort the results from a Stored Procedure? Or more
importantly, what is the fastest and most efficient way?

I know I can do the sorting within the recordset in ASP, but AFAIK this is
not the most efficient method.

Ideally, I''d like to pass a parameter to the SP to indicate sorting field
order...

How do you guys go about this?

Thanks

Chris

--
cj*******@REMOVEMEyahoo.co.uk
[remove the obvious bits]

推荐答案

http://www.aspfaq.com/show.asp?id=2501


-

David Portas

SQL Server MVP

-

http://www.aspfaq.com/show.asp?id=2501

--
David Portas
SQL Server MVP
--


我有一些内容要添加,但是现在,
http:// www.aspfaq.com/2501

" CJM" < CJ ******* @ newsgroup.nospam>在消息中写道

新闻:uL ************* @ TK2MSFTNGP15.phx.gbl ...
I have some content to add, but for now,
http://www.aspfaq.com/2501
"CJM" <cj*******@newsgroup.nospam> wrote in message
news:uL*************@TK2MSFTNGP15.phx.gbl...
如何动态排序存储过程的结果?或者更重要的是,什么是最快最有效的方式?

我知道我可以在ASP的记录集中进行排序,但AFAIK这不是最有效的方法。

理想情况下,我想将一个参数传递给SP以指示排序字段
命令...

你们怎么去这个?

谢谢

Chris

-
cj ******* @ REMOVEMEyahoo.co.uk
[删除明显的位]
How can I dynamically sort the results from a Stored Procedure? Or more
importantly, what is the fastest and most efficient way?

I know I can do the sorting within the recordset in ASP, but AFAIK this is
not the most efficient method.

Ideally, I''d like to pass a parameter to the SP to indicate sorting field
order...

How do you guys go about this?

Thanks

Chris

--
cj*******@REMOVEMEyahoo.co.uk
[remove the obvious bits]



在SP


ORDER BY

CASE @Param

WHEN 1 THEN col1

当2那么col2
In SP

ORDER BY
CASE @Param
WHEN 1 THEN col1
WHEN 2 THEN col2


这篇关于动态排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆