what is difference between function overloading and function overrriding in sql server

Posted on 2009-04-23
Last Modified: 2012-05-06
what is difference between function overloading and function overrriding in sql server
Question by:vikasbapat
    LVL 4

    Accepted Solution

    Function Overloading:
    More than one function may be defined with the same SQL name, so long as the arguments they take are different. In other words, function names can be overloaded. When a query is executed, the server will determine which function to call from the data types and the number of the provided arguments. Overloading can also be used to simulate functions with a variable number of arguments, up to a finite maximum number.

    For example lets assume 2 functions with the same name like below:

    CREATE FUNCTION test(int, real) RETURNS ...
    CREATE FUNCTION test(varchar) RETURNS ...

    In the upper example if you call the function like below

    select test('somevarcharvalues')

    It will call the second version of the function. But if you call like below

    select test(1,1.5)

    It will call the first version

    Function Overriding:
    This one is totaly diffrenet. In this case you are dircetly changing the function it self.
    For example lets suppose built in Count sql function. If you change this function thw way that it is processing than you override it.
    For example it will only count the rows which have column length more than 10.

    Hope theese information will help you to understand the diffrence.

    Take care.


    Author Closing Comment

    ok Thanh you

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
    PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now