Friday, March 23, 2012

Passing different number of parameters to a Stored Procedure

Hi to all,

How can I Pass different number of parameters to a Stored Procedure?

In my Requirement,

Some times i want to pass 2 parameters only,

In some cases i want to pass 6 parameters.

How can i do this?

Please give me a solution.

Thanx in advance...

You will have to use optional parameters then. The procedure head should look like something as the following:

CREATE PROCEDURE SomeProc
(
SomeParam INT = NULL,
SomeOtherParameter INT = 2
)(...)

HTH, jens K. Suessmeyer.


http://www.sqlserver2005.de

No comments:

Post a Comment