Link to home
Start Free TrialLog in
Avatar of cheryl9063
cheryl9063Flag for United States of America

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,

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cheryl9063

ASKER

Perfect thanks so much!!