Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Unanswered: Decode in SQL Server

    Hi

    I have oracle statement and I want to translate it in SQL Server:

    select DECODE(count(bid_Vendor), 1, NULL, COUNT(BID_VENDOR))
    from bid_total

    I tried it this way:
    Select case(count(bid_vendor) when 1 then null else count(bid_vendor)end) as cs from bid_total

    It gave me error i.e.

    Incorrect syntax near the keyword 'when'
    mr_roomi

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    Select CASE count(bid_vendor)
       WHEN 1 then null
       ELSE count(bid_vendor)
       END as cs
       FROM bid_total
    -PatP

Posting Permissions

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