?
Solved

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

Posted on 2009-04-23
2
Medium Priority
?
404 Views
Last Modified: 2012-05-06
what is difference between function overloading and function overrriding in sql server
0
Comment
Question by:vikasbapat
2 Comments
 
LVL 4

Accepted Solution

by:
Cakinci earned 1500 total points
ID: 24213222
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.
 
 

0
 

Author Closing Comment

by:vikasbapat
ID: 31573693
ok Thanh you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

850 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