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 Greame
You nee to use the following syntax!
Helps
Nick
case
when @HoldDetail = 1 and ps.seat_status = 4 then 1
else 0
end
Nicholas Insell Rheolwr Cronfa Ddata Database Manager Canolfan Mileniwm Cymru Wales Millennium Centre
029 2063 4672 www.wmc.org.uk
Dy Le Di Make it Yours this year
Cysylltwch yn Gymraeg neu'n Saesneg fel dymunwch Contact us in English or Welsh as you prefer
Meddyliwch am yr amgylchedd cyn printio / Please consider the environment before printing this email
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Graeme Ellis Sent: 29 September 2009 14:37 To: Nick Insell Subject: [Tessitura Technical Forum] CASE statement help
This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!