在存储过程中如何按降序设置列 [英] In stored procedure how to set the column in descending order

查看:51
本文介绍了在存储过程中如何按降序设置列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sp:



@SQL = @SQL +'ORDER BY'+ COALESCE(@Select_Fields +',','')+'Period'





在上面的代码中,如何按降序获取句点列。



我尝试过:



sp:

@SQL = @SQL + ' ORDER BY ' + COALESCE ( @Select_Fields + ',','') + ' Period'


In the above code how to get the period column in descending order.

What I have tried:

In the above code how to get the period column in descending order.

推荐答案

@SQL = @SQL + ' ORDER BY ' + COALESCE ( @Select_Fields + ',','') + ' Period DESC'





SQL ORDER BY关键字 [ ^ ]


这篇关于在存储过程中如何按降序设置列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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