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

    Red face Unanswered: Create a View in MSSQL 2000

    I 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 exist in the EMAILaddress column then I need to have a Y show in another column called EMAILflag, if the EMAILaddress does not exist then I would need the EMAILflag to be a N.

    Any HELP would be GREAT.
    Thank You!!

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Quote Originally Posted by cle5cap
    I 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 exist in the EMAILaddress column then I need to have a Y show in another column called EMAILflag, if the EMAILaddress does not exist then I would need the EMAILflag to be a N.

    Any HELP would be GREAT.
    Thank You!!
    Check out the CASE Statement in Books on Line.

    Regards,

    hmscott
    Have you hugged your backup today?

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Select order_NO, shiptoname, Shiptoaddress, Shiptocity,shiptostate, shiptozip, EMAILaddress
    FROM orders;

    Semi-Colon(";")

    Is this for DB2 or Oracle 8i?

    SQL Server would be

    Code:
    SELECT    order_NO
    	, shiptoname
    	, Shiptoaddress
    	, Shiptocity
    	, shiptostate
    	, shiptozip
    	, EMAILaddress
    	, CASE WHEN EMAILaddress IS NULL THEN 'N' ELSE 'Y' END AS EMAILflag
      FROM orders
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    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
  •