uncleroydee
Technical User
I'm creating a form to insert record(s) to a SQL database via a stored procedure and plan to allow the users to insert between 1 and 15 records in one submission. This creates a SQL problem for me.
I intend to write 15 seperate execute stored preocedure commands eg "exec SP_myprocedure1 1Param1, 1Param2, 1Param3... exec SP_myprocedure2 2Param1, 2Param2, 2Param3...". The problem is when SQL Server executes a stored procedure it expects to see a value for every parameter included in that stored procedure and fails with an error message when it encounters an empty parameter. Therefore, I need to write an "if" function that will execute the stored procedure only when a key parameter within the procedure contains a value and, will end without error when it encounters the first empty key parameter.
I am working on data validation for the insert form to ensure that all fields in a particular record are complete (reference posting "Required field validation function"
but if anyone has any experience writing a script that will check for a value before executing a stored procedure it would be a great help.
Thanks for your time, I welcome all suggestions.
I intend to write 15 seperate execute stored preocedure commands eg "exec SP_myprocedure1 1Param1, 1Param2, 1Param3... exec SP_myprocedure2 2Param1, 2Param2, 2Param3...". The problem is when SQL Server executes a stored procedure it expects to see a value for every parameter included in that stored procedure and fails with an error message when it encounters an empty parameter. Therefore, I need to write an "if" function that will execute the stored procedure only when a key parameter within the procedure contains a value and, will end without error when it encounters the first empty key parameter.
I am working on data validation for the insert form to ensure that all fields in a particular record are complete (reference posting "Required field validation function"
Thanks for your time, I welcome all suggestions.