Hello everyone
I am trying to alter one of our stored procedures and SQL is driving me a bit loopy. I’m trying to put an IF statement inside a CASE statement e.g.
case @HoldDetail when 1 then if ps.seat_status = 4 then 1 else 0 end else 0 end,
but SQL is having none of it. Basically I was it to return ‘1’ if @HoldDetail is ‘1’ and ps.seat_status is ‘4’ otherwise it should return ‘0’.
Could you help at all? I’m sure its pretty obvious but beyond my SQL knowledge I’m afraid
Thanks everso
Graeme
Young Vic Theatre
Hi Graeme,
You can try this...
'HoldDetail' = case when @HoldDetail = 1 and ps.seat_status = 4 then 1 else 0 end,