Click here to Skip to main content
15,899,937 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to perform all dml operation by a single stored procedure in sql server 2005. how could I achieve this? Please Help
Posted
Updated 11-Aug-12 2:55am
v2
Comments
Mohamed Mitwalli 11-Aug-12 10:06am    
Why you want to do this ??
Wendelius 11-Aug-12 10:14am    
You should explain more. Why you want to do this, do you want all DML operations for one table or several tables and so on
[no name] 11-Aug-12 11:04am    
Okay so do it. It's a bad idea but go ahead anyway. Plenty of examples of how to do this very thing if you search for it.

The only way this is possible is through the use of EXEC, but code using EXEC will run with the users security permissions, so you will have to give access to tables and views etc.

Generally this is not a good practice, if you are looking to write less code and having less to maintain then I would suggest not using stored procedures and embedding SQL in your code (much faster, single source control point, and not bound to a specific vendor).
 
Share this answer
 
This will not be the good option. You'll find much difficulty to manage the data. If you want to use single stored procedure for all the DML operation you can have it but you need to maintain an indicator as input parameter. Every time you need to check the parameter and based upon that you need to perform the operations. Better to go with the individual parameters.


--Amit
 
Share this answer
 
Comments
_Raj sinha 12-Aug-12 1:30am    
hii Amit, Thanx for suggesting me.

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