存储过程中select  where条件后如果条件关联变量则可以使用如下代码,变量允许为空,当为空时则不会执行筛选条件 

 

Select Distinct TR.int_id, TR.vch_pmd  from  table_r   TR 
inner join TABLE_PPT  on TPPT.int_id = TR.int_id 
where   (TPPT.vch_s_code = @in_Code or len(isnull(@in_Code, '')) = 0)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
相关资源
相似解决方案