Avatar of chokka
chokka
Flag for United States of America asked on

Whether Drop and Create Stored Procedure is best practice for deployment (or) Alter Stored Procedure is best practice for deployment?

Whether Drop and Create Stored Procedure is best practice for deployment (or) Alter Stored Procedure is best practice for deployment?

I am working on automating a process of deploying Stored Procedures across the Servers through SSIS Package.

My clarification is, when we deploy an existing stored procedure across the environments , Whether we can drop and create (or) Alter would be fine?
Microsoft SQL ServerSSISSQL

Avatar of undefined
Last Comment
D B

8/22/2022 - Mon
Pratik Somaiya

Ohh okay, I got your question now.

You should use ALTER in case of the stored procedure so as to maintain the permissions associated with that stored procedure.

Regards,
Pratik
Pratik Somaiya

whenever you DROP and CREATE you may lose the permissions associated with that object.
SStory

I haven't used SSIS. I am curious though as to why you wouldn't drop if exists and the recreate them. Are you worried about losing permissions on them? If so can't it run something to GRANT those as needed?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
chokka

ASKER
@SStory, My question is " Which is the best practice? "

Either Drop and Create
(or)
Alter


I understand about losing the permission on Drop and Create. We can add a Grant Permission syntax after create.

  1. Drop Procedure
  2. Create Procedure
  3. Grant Permission


Which is the best practice to follow for SP Deployment from DBA Stand point?
ASKER CERTIFIED SOLUTION
D B

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
chokka

ASKER
Thanks
D B

no problem. Thank you.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.