Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Location
    Mars
    Posts
    137

    Unanswered: User defined functions in SQL Server 7.0

    hai,

    I have 3 fields in my table say (F1, F2, F3). I want to get the max value out of the three fields for each row. I can create a user-defined function which accepts 3 arguments and then return the max value if i am using SQL Server 2000. But now i am using only SQL Server 7.0 (it does not support user-defined functions )

    So any one could kindly let me know how could i do it in SQL Server 7.0

    Thnks in advance
    Sudar

    --
    My Blog

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd use:
    Code:
    CASE
       WHEN F1 > F2 AND F1 > F3 THEN F1
       WHEN F2 > F3 THEN F2
       ELSE F3
    END
    -PatP

  3. #3
    Join Date
    Jul 2004
    Location
    Mars
    Posts
    137
    Thnks PatP...

    It really works...
    Sudar

    --
    My Blog

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    May be, may be not...Where's WHEN F1 > F2 but <= F3?
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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