Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure owner - how do you change it.

Status
Not open for further replies.

Braveheart1326

Technical User
Mar 15, 2004
6
GB
Hi there

I am relatively new to SQL Server so please bear with me as I ask what will probably be an easy question.

I have a developer who created a stored procedure and he is showing as the OWNER of it instead of DBO. I want to change the owner to DBO and thought I could use the sp_changeobjectowner stored procedure to do so but I dont appear to be able to get it to work.

Can anyone advise how I would attempt this.

Thanks
Ronnie
 
SO ... this command did not work????
Code:
sp_changeobjectowner @objname = 'StoredProcedureName', @newowner = 'DBO'

Of course you need to change 'StoredProcedureName' to the name of the SP you are trying to change.

You may not have the correct permissions on the account you are logged in with to accomplish this task.

Thanks

J. Kusch
 
Drop the sp and recreate it using the correct owners profile.

But you should be able to use sp_changeobjectowner to do it.
Try using the owner.procname to specify the object to change.


======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Hi there

Thanks for the guidance. I had tried to use the SP_changeobjectowner as per the books online example and it failed, however the example shown above when used was successful.

Many thanks
Ronnie
 
Morning Braveheart1326 ...

Which example/info above was the charm?

Thanks

J. Kusch
 
Hi again

The one thats listed as

sp_changeobjectowner @objname = 'StoredProcedureName', @newowner = 'DBO'

Thanks
Ronnie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top