alter procedure [dbo].[SP_Tgongxu_SelByMore]
@gx_name nvarchar(50)=null,
@gx_alias nvarchar(50)=null,
@gx_account_mode nvarchar(50)=null,
@gx_istime int=null,
@gx_iskeygongxu nvarchar(10)=null,
@gx_isdos nvarchar(10)=null,
@gx_isquality int=null,
@gx_ischoujian int=null,
@gx_account_soft nvarchar(50)=null
as
declare @sql nvarchar(4000)
set @sql=coalesce(@sql,'')+
coalesce(' gx_name='''+@gx_name+''' and','')+
coalesce(' gx_alias='''+@gx_alias+''' and','')+
coalesce(' gx_account_mode='''+@gx_account_mode+''' and','')+
coalesce(' gx_istime='+cast(@gx_istime as varchar)+' and','')+
coalesce(' gx_iskeygongxu='''+@gx_iskeygongxu+''' and','')+
coalesce(' gx_isdos='''+@gx_isdos+''' and','')+
coalesce(' gx_isquality='+cast(@gx_isquality as varchar)+' and','')+
coalesce(' gx_ischoujian='+cast(@gx_ischoujian as varchar)+' and','')+
coalesce(' gx_account_soft='''+@gx_account_soft+''' and','')
if len(@sql)>0 set @sql=' where'+left(@sql,len(@sql)-4)
set @sql='select * from Tgongxu'+@sql
exec(@sql)
go
本文介绍了一个SQL存储过程,该过程允许通过多个参数灵活查询数据库表Tgongxu中的记录。参数包括工序名称、别名、账户模式等,可根据实际需求组合使用。
2566

被折叠的 条评论
为什么被折叠?



