none
How do I call a scalar user defined function? RRS feed

  • Question

  • I have the following udf;

    CREATE FUNCTION [dbo].[MathMax] (@parm1 int,@parm2 int) RETURNS int
    AS
    BEGIN
    if @parm1 > @parm2
        return(@parm1) 
        return(@parm2)
    END

    When I try to call it using a simple select 
    select dbo.MathMax(1, 2)

    I get the following error:

    Cannot find either column "dbo" or the user-defined function or aggregate "dbo.MathMax", or the name is ambiguous.

    I'm at a loss. Any pointers?


    Mike Swaim
    Thursday, February 19, 2009 4:05 PM

Answers

  • You have something else gong on; when I execute this it works fine for me.
    • Marked as answer by mpswaim Thursday, February 19, 2009 4:39 PM
    Thursday, February 19, 2009 4:08 PM
    Moderator

All replies

  • You have something else gong on; when I execute this it works fine for me.
    • Marked as answer by mpswaim Thursday, February 19, 2009 4:39 PM
    Thursday, February 19, 2009 4:08 PM
    Moderator
  • Argh. After completely disconnecting from SQL Server and reconnecting (just closing the query window and opening a new one didn't work), it works just fine.
    Grrrr.
    Mike Swaim
    Thursday, February 19, 2009 4:41 PM