cheryl9063
asked on
Help with SQL CASE SELECT
See my code below.. I want the code to put the field sComment to stated below if the berrorflag is 0 otherwise I want the sComment to have something else.. The second "case" keword is highlighted and I'm not sure what I'm doing wrong
CASE
WHEN css.bErrFlag =0
CASE (css.sDeliveryMethod)
WHEN 'fax' THEN 'Web customer requests the listed invoice number: ' + (css.sTransactionNo) + ' to be sent via: '
+ (css.sDeliveryMethod) + ' to ' + COALESCE(css.sPhone_Fax, '')
WHEN 'email' THEN 'Web customer requests the listed invoice number: ' + (css.sTransactionNo) + ' to be sent via: '
+ (css.sDeliveryMethod) + ' to ' + COALESCE(css.semail, '')
WHEN 'e-mail' THEN 'Web customer requests the listed invoice number: ' + (css.sTransactionNo) + ' to be sent via: '
+ (css.sDeliveryMethod) + ' to ' + COALESCE(css.semail, '')
WHEN 'mail' THEN 'Web customer requests the listed invoice number: ' + (css.sTransactionNo) + ' to be sent via: '
+ (css.sDeliveryMethod) + ' to ' + COALESCE(css.saddress1, '') + '; ' + COALESCE(css.sAddress2, '')
+ '; ' + COALESCE(css.scity, '') + ', ' + COALESCE(css.sstate, '') + ' ' + COALESCE((right(css.szip,5)), '')
ELSE 'Customer requested invoices be sent and did not choose a delivery method. '
END
ELSE 'Error in case:'+(css.sErrMsg)
END sComment,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER