• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

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

what is difference between function overloading and function overrriding in sql server
0
vikasbapat
Asked:
vikasbapat
1 Solution
 
CakinciCommented:
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
 
vikasbapatAuthor Commented:
ok Thanh you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now