• John Mitchell-245523 (5/26/2016)


    If userabc has just restored the database, then it's going to be the database owner (dbo), so you shouldn't need to run sp_change_users_login. Unless I've missed something, that is. On a more general note, you should use ALTER USER instead of the stored procedure, which is deprecated.

    John

    You can use EXECUTE AS in your SP if that is what you are looking for. But as john has rightly you already have access since you just restored it, and if it is for a different user you can you ALTER USER command to change the login associated (Unless you are using SQL Server 2000). Either way sysadmin is way too high privilege we are considering for this requirement.

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]