Tuesday, March 27, 2012

Changing the ownership of a object

Hi all,

I have a problem while executing a stored procedure. I have created a database called "cpd" and created some stored procedures. for all my stored procedure the owner is "CPDUSER". when ever i am executing any stored procedures i have to write the user name first else it is not working.

let's say i have a stored procedure called "cp_checklogin". it takes 2 parameters. to execute this i have to write

exec cpduser.cp_checklogin 'admin@.jk.com', 'admin'

but i don't want to write the user name there. and if without username "CPDUSER" i am trying to execute the stored procedure it is throwing me the error that "the stored procedure cp_checklogin is not exist in the database". can anybody suggest me. it's very urgent.

Thanks in advance

Krishna

The cp_checklogin stored procedure has been created in the cpduser schema. The user making the call likely has 'dbo' as their default schema.

To fix this, you can either recreate the stored procedure in the dbo schema or you can change the default schema for the user making the call (for help on this, see http://msdn2.microsoft.com/en-us/library/ms190387.aspx)

|||Another option would be if you use SQL 2000 (you did not mention that) to change the ownership of existing objects using sp_changeobjectowner.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment