Saturday, February 25, 2012

Overloaded Stored Procedure

Hi

I want to create two stored procedures with the same name but accepting different params. Lets say Procedure A can accept param1, Procedure A can also accept param1,param2.

Is there any way SQL Server supports overloaded procedures with different sigantures.

Regards
ImtiazYou can use a feature called numbered stored procedures. So you can create somesp;1 and somesp;2. But I would not recommend doing this since the feature is being deprecated. In general, for data access or modifications you want to keep the TSQL interfaces simple to use.|||Thanks..As expected u had replied.....|||Can we also have something like overloaded functions in SQL 2005.|||No, but optional parameters are supported: CREATE PROC YourProc @.Param1 INT, @.Param2 INT = 0 AS ... -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457-- <Imtiaz@.discussions.microsoft.com> wrote in message news:5dcaf46b-f56a-452b-b9a3-dc23f7c4e7a9@.discussions.microsoft.com...HiI want to create two stored procedures with the same name but accepting different params. Lets say Procedure A can accept param1, Procedure A can also accept param1,param2.Is there any way SQL Server supports overloaded procedures with different sigantures.RegardsImtiaz

No comments:

Post a Comment