存儲過程中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)
存儲過程中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)
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。