October 7, 2010 at 8:59 am
We achive the same using an 'execute_all' role that has permission execute on all SPs. We just need to update the role in that case.
Moe M
Database Consultant
http://www.cubeangle.com
October 7, 2010 at 9:02 am
Can anyone say if ALTER PROCEDURE has the same problem as sp_rename?
October 7, 2010 at 9:06 am
Linked on my LinkedIn profile. I wonder how wide the scope of this issue is. I have seen rename used many times and I bet there are alot of DBA's that will be glad to find out about this...
Peter Trast
Microsoft Certified ...(insert many literal strings here)
Microsoft Design Architect with Alexander Open Systems
October 7, 2010 at 9:11 am
I don't think you rename a stored procedure using 'ALTER PROCEDURE ...'
Moe M
Database Consultant
http://www.cubeangle.com
October 7, 2010 at 9:12 am
Alter procedure will update syscomments, so will drop/creating the procedure.
October 7, 2010 at 9:24 am
Yes after the re-name has occured if you alter procedure then it will update the syscomments
Moe M
Database Consultant
http://www.cubeangle.com
October 7, 2010 at 9:40 am
But if you're going to rename and alter, you might as well just drop and create. It's cleaner.
October 7, 2010 at 9:41 am
Agreed. DROP/CREATE is also easier to be put in a script
Moe M
Database Consultant
http://www.cubeangle.com
October 7, 2010 at 10:03 am
For the same reason I never use sp_rename to rename object in sql server.
Always prefer if exist method.
if exists (select * from sys.objects where object_id = object_id(N'[dbo].[Object_name]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
drop procedure [dbo].[object_name]
GO
Create procedure dbo.object_name
as
SQL DBA.
October 7, 2010 at 10:07 am
Nice article, I think it is good to bring light to this situation.
However, I think it is interesting that you only found the problem because of bad data on a report. Does your application to copy the database not report the errors it encounters while transferring objects? (Proper error handling could have saved you hours of investigation.)
October 7, 2010 at 10:24 am
UMG Developer (10/7/2010)
Nice article, I think it is good to bring light to this situation.However, I think it is interesting that you only found the problem because of bad data on a report. Does your application to copy the database not report the errors it encounters while transferring objects? (Proper error handling could have saved you hours of investigation.)
Well as far as the application is concerned no error has occured here. The SQLDMO pulled all objects and scripted them successfully. Only when running the generated script have you the chance to check the errors and see if any of your create statements have failed due to duplicate create statements and of course we failed at this point.
Moe M
Database Consultant
http://www.cubeangle.com
October 7, 2010 at 11:17 am
Mohammad Meimandi (10/7/2010)[hrWell as far as the application is concerned no error has occured here. The SQLDMO pulled all objects and scripted them successfully. Only when running the generated script have you the chance to check the errors and see if any of your create statements have failed due to duplicate create statements and of course we failed at this point.
OK, I thought that the application generated and executed the scripts, but I see I missed the part that you run the scripts manually.
October 7, 2010 at 6:47 pm
Thanks for the article.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
October 7, 2010 at 11:17 pm
We also encountered this problem when we generate using sql compare application. Our workaround is to drop and recreate the procedure or functions. Great article!
October 8, 2010 at 9:17 am
CirquedeSQLeil (10/7/2010)
Thanks for the article.
Thanks for reading it!
Moe M
Database Consultant
http://www.cubeangle.com
Viewing 15 posts - 16 through 30 (of 36 total)
You must be logged in to reply to this topic. Login to reply