Click here to Skip to main content
14,920,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to run the Insert Update Delete Query in a single stored procedure while using a different condition. I'm creating this so the different parameter input value in this give error like insert parameter not passed.

Can any one help or suggest.

Thanks in Advance.
Posted
Updated 22-Dec-10 23:20pm
v2
Comments
Slacker007 23-Dec-10 5:21am
   
No need to capitalize the first letter of ever word. Thank you.

Frankly speaking, I WOULD NOT suggest you to do this.

Each Stored procedure should do it's own work, and, this would allow you to manage and use these stored procedure in a clean manner. Otherwise, if you use the same stored procedure for Insert, Delete and Update operations, you need to send unnecessary parameters (Parameters for Insert) while executing the Delete operation.

This also increases Coupling and Troubleshooting will also get harder.

So, better don't do this, and, create a different Stored Procedure for each different operation (Insert, Update, Delete).

Cheers.
   
Comments
Slacker007 23-Dec-10 6:12am
   
Very good advice.
Really it's not suggestible as Al-Farooque Shubho said. Better separate procedures for Insert/Update/Delete/etc.,

BTW I have answered similar question exactly 2 months ago(23 Oct '10).

how to create ADD,UPDATE,DELETE Store Procedure in One Store Procedure[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900