Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    29

    Exclamation Unanswered: SQL view using the CASE try to find the @

    have created a view in MS SQL2000 as followed:

    Select order_NO, shiptoname, Shiptoaddress, Shiptocity,shiptostate, shiptozip,
    EMAILaddress
    FROM orders;

    my question is: If the email @ sign exist in the EMAILaddress column then I need to have a Y show in another column called EMAILflag, if the @ sign does not exist then I would need the EMAILflag to be a N.

    This what I have but the emailaddress column is not always null it just has spaces in the field.
    Select order_NO, shiptoname, Shiptoaddress, Shiptocity,shiptostate, shiptozip,
    EMAILaddress, CASE WHEN emailaddress IS NULL THEN 'N' ELSE 'Y' END AS emailflag
    FROM orders;

    Any HELP would be GREAT.
    Thank You!!

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by cle5cap
    Any HELP would be GREAT.
    Any you say?

    Code:
      Select order_NO, shiptoname, Shiptoaddress, Shiptocity,shiptostate, shiptozip,
    EMAILaddress, CASE WHEN emailaddress LIKE '%@%' THEN 'N' ELSE 'Y' END AS emailflag
    FROM orders
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2004
    Posts
    29
    Thank You......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •