Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Posts
    22

    Unanswered: WHEN? IF? statement

    Hi DBForums users and HAPPY NEW YEAR!!!



    I want to get data from MSSQL server with a select command. ın one column valuetype is bit. If I get the data it displays it in checkboxes in datagridview which ı use in my software. I only want to display words where checkboxes are bieng displayed. I tried to add a when statement it this query:
    SELECT ID,Name, ....., WHEN Correction='True' THEN 'Yes' ELSE 'No', ... FROM table_name

    If I execute it it finds an error in WHEN statement. I cant find the problem?

    thanks for help!

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Straight from BOL ... you could look it up!

    Code:
     <H5>Syntax
    Code:
    Simple CASE function:
    CASE input_expression 
        WHEN when_expression THEN result_expression 
            [ ...n ] 
        [ 
            ELSE else_result_expression 
        ] 
    END 
    Searched CASE function:
    CASE
        WHEN Boolean_expression THEN result_expression 
            [ ...n ] 
        [ 
            ELSE else_result_expression 
        ] 
    END
    </H5>

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    Jul 2007
    Posts
    22
    yes I looked at it but I dont understand and I cant find an example in use. I am programming in vb.net so it is really different than vb syntax... Ill try it... I thought that case and when statements are seperated...

  4. #4
    Join Date
    Jul 2007
    Posts
    22
    Ok when I tried it in the first time an error occured because of a letter missing thanks a lot

Posting Permissions

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