开发者

Is it possible to change owner of SP in Crystal reports at runtime?

I'd like开发者_高级运维 to change the owner of stored procedure (i.e. dbo) for smth else in crystal reports at runtime. Is it possible? TIA

UDP May be I need to clarify. I have a reports with lots of subreport within. I have to use this report with the other database. So I need to change the scheme of stored procedure at runtime without changing anything at DB.

Should I use SetDataSource() method or is there smth else more corresponding changing scheme task?


You can achieve the desired effect without changing the owner using the EXECUTE AS Clause.

CREATE PROCEDURE dbo.TestProcedure
WITH EXECUTE AS OWNER

There are basically five types of impersonation that can be used:

  • SELF - the specified user is the person creating or altering the module
  • CALLER - this will take on the permissions of the current user
  • OWNER - this will take on the permissions of the owner of the module being called
  • 'user_name' - a specific user
  • 'login_name' - a specific login

See Sommarskog's canonical reference: Giving Permissions through Stored Procedures


To answer the original question, you can use the sp_changeobjectowner system sproc to change the owner of an object in the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜