Creating an NVL function in SQL Server

  • Hello,

    I have an application that can connect to both an Oracle and a SQL Server database.  I have a query, which gets executed at runtime, that has an NVL in the where clause.  I'd like to write a sql server function called NVL so that I don't have change the where clause.  I've got a function that works.  The problem is that my new function is named 'dbo.NVL'.  What can I do so that my function just has the name 'NVL'?  That way, I won't have to change any code in my application.

    Any help on this one is greatly appreciated.

    Thanks,

    Bob

  • AFAIK User defined functions have to be invoked with at least a two part name dbo.fnMyFunction

  • Why not use COALESCE() which is present in both Oracle as well as SQL Server rather than writing UDFs for these ?

  • Yes, COALESCE() will do what I need...never thought of it.  Thanks for the help.

    Bob

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply