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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -