How to pass a variable number of parameters to a SQL Server stored procedure?
问题 I used SQL Server 2005 for my small web application. I Want pass parameters to SP . But there is one condition. number of parameter that can be change time to time. Think ,this time i pass name and Address , next time i pass name,surname,address , this parameter range may be 1-30 , 回答1: You declare the procedure with default parameters and you invoke it with named parameters instead of positional parameters: CREATE PROCEDURE usp_myProcedure @name varchar(100) = '', @surname varchar(100) = '',