CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2000
    Posts
    163

    Query with SQL Server

    Hello

    I have problem with Query on SQL Server DB.
    I want to show field with condition, in Access I wrote it that way:

    SELECT iif (condition, field1, field2), field3 FROM Table1

    I try it that way but SQL Server dont recognize 'iif' function.

    Is any body know how do i do it in SQL Server ? (without using Store Procedure).

    Thanks for any help.


  2. #2
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: Query with SQL Server

    look at the case structure for sql server. You can include this in your select.

    select case condition field1 else field2, field3 from table1
    That is only the rough syntax but the case statement will do what you are looking for.



  3. #3
    Join Date
    Dec 2000
    Posts
    163

    Re: Query with SQL Server

    I try it and it don't work.


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured