sql server - Creating sql procedure with insert,Update,delete and select operation in one procedure.Is this better way? -
i use sql server 2008 r2 version. created procedure includes operation of table select,insert, update,delete operation in 1 procedure. here procedure created.
create procedure [dbo].[my_proc] @operation nvarchar(50) begin set nocount on; if(@operation ='insert') begin --insert query end if(@operation ='update') begin --update query end if(@operation ='delete') begin --delete query end if(@operation ='select') begin --select query end end
**which better?
like above procedure example.
or write separate query each operation.**
Comments
Post a Comment