使用一个存储过程实现多条件查询
来源:互联网 发布:淘宝网三星a9手机壳 编辑:程序博客网 时间:2024/05/21 18:35
在开发过程中,经常要写存储过程实现搜索,但搜索条件在不同的模块可能是不同的;因此能否用一个存储过程来实现不同的条件查询呢? 答案是肯定的。
CREATE proc GetReportInfoOfSendBook
@condition nvarchar(500)
as
exec( 'select b.sendbookname ,a.ordernumber ,a.BookName ,a.PayPrintBillID ,a.printpapernumber,a.price ,b.sendbooknum,b.discount,Edition,ProfileEdition ,
a.price*b.sendbooknum*(case b.discount when 0 then 1.00 else b.discount /100 end) as maYang
from
Tb_payprintbill a,tb_sendbookinfo b where a.payprintbillid=b.payprintbillid and billstatusID<>2
'+@condition+' order by b.sendbookname')
GO
CREATE proc GetReportInfoOfSendBook
@condition nvarchar(500)
as
exec( 'select b.sendbookname ,a.ordernumber ,a.BookName ,a.PayPrintBillID ,a.printpapernumber,a.price ,b.sendbooknum,b.discount,Edition,ProfileEdition ,
a.price*b.sendbooknum*(case b.discount when 0 then 1.00 else b.discount /100 end) as maYang
from
Tb_payprintbill a,tb_sendbookinfo b where a.payprintbillid=b.payprintbillid and billstatusID<>2
'+@condition+' order by b.sendbookname')
GO
- 使用一个存储过程实现多条件查询
- 存储过程多条件查询
- 使用MVC,实现多条件查询,排序与分页 的 存储过程
- 存储过程条件查询
- 存储过程-分隔符号-多条件查询
- 多条件查询存储过程 例一
- 多条件查询存储过程-SQL Server
- sqlserver2005多选,多条件查询存储过程
- Oracle多条件查询分页存储过程
- 存储过程动态条件查询
- 带参数的存储过程实现任意条件的查询
- MVC调用存储过程实现分页,带查询条件
- SQLServer 存储过程中不拼接SQL字符串实现多条件查询
- SQLServer 存储过程中不拼接SQL字符串实现多条件查询
- SQLServer 存储过程中不拼接SQL字符串实现多条件查询
- repeater插入,多选删除,条件查询实例(存储过程实现)
- SQLServer 存储过程中不拼接SQL字符串实现多条件查询
- SQLServer 存储过程中不拼接SQL字符串实现多条件查询
- 多个下拉列表(select)不能取重复值判断-动态增加输入框-模仿CSDN结贴时分数判断-但无层提示-Ajax取值(全部源码)
- 传说是百度的面试题
- ASP.NET 3.5的新特色 vs2008
- 商用数据挖掘的两个关键环节
- 萧何月下追韩信时候,韩信对项羽的这个评价是否属实
- 使用一个存储过程实现多条件查询
- Fix Your Site With the Right DOCTYPE!
- 山僧不识英雄主,何必晓晓问姓名
- PO BO VO DTO POJO DAO概念及其作用(附转换图)
- 狭巷短兵相接处,杀人如草不闻声
- 网络与文化
- 情感类文章全部转移到blog.sina.com.cn/jiwenyi163
- IE编程2(.net)——通过应用程序打开google并进行搜索
- 为什么打开另一台电脑后我的网络电视才能流畅播放