码迷,mamicode.com
首页 > 其他好文 > 详细

存储过程多条件查询

时间:2018-08-13 19:43:47      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:cli   har   proc   存储   roc   style   customer   nvarchar   lis   

 1 1.存储过程
 2 
 3 ------------------------------------
 4 --用途:[综合查询]多条件查询/GBC查询   
 5 --时间:2011-2-14 8:18:31
 6 --名称:dangqinghua
 7 ------------------------------------
 8 ALTER PROC [dbo].[DKI_GeneralSearch]
 9     @SqlWhere  NVARCHAR(4000)=‘‘,
10     @CMD varchar(20)=‘‘
11 AS
12 declare @sqlStr varchar(4000) 
13 declare @sqlStr2 varchar(4000) 
14 set @sqlStr = select * from Customer where 1=1
15 set @sqlStr2=select * from gbclist where 1=1
16 begin
17  if(@CMD=GeneralSearch)
18     begin
19    if @SqlWhere is not null  
20      set @sqlStr   
21         exec(@sqlStr) 
22     end 
23      else if (@CMD=gbclist)
24   begin
25    if @SqlWhere is not null
26       set @sqlStr2 
27       exec(@sqlStr2)
28   end     
29 end
30 
31 收藏于 2011-03-09

 

存储过程多条件查询

标签:cli   har   proc   存储   roc   style   customer   nvarchar   lis   

原文地址:https://www.cnblogs.com/dqh123/p/9470099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!