0
select t1.customer_code as doc_num, CONVERT(VARCHAR,t2.created_on,103) as doc_date,
t2.sap_cardcode as sap_doc_num ,t2.void_flg,t2.status_ind,t2.err_msg
from customer t1
inner join sap_customer t2 on t1.id = t2.customer_id
where t2.status_ind = case when @test = 'todo' then t2.status_ind='1' else t2.status_ind='0' END
上面是我需要做的select语句,它基于where语句,我需要传递一个param来确定它应该执行哪个。 Status Ind = 1或Status Ind = 0sql case语句在哪里?
你得到的错误是什么? – Ravi
“=”附近的语法不正确 – hunt
在WHERE子句中使用AND/OR而不是用例表达式通常更好。 – jarlh