Friday, March 23, 2012

Permissions Question For SQL Login Account

I have a SQL login account defined with DBO permissions on a particular
database. When this login attempts to run the sp_updatestats stored
procedure, the following error occurs: "User does not have permission to
perform this action." According to BOL, the DBO has permissions to execute
this stored procedure. Any help would be appreciated.
MACason wrote:
> I have a SQL login account defined with DBO permissions on a
> particular database. When this login attempts to run the
> sp_updatestats stored procedure, the following error occurs: "User
> does not have permission to perform this action." According to BOL,
> the DBO has permissions to execute this stored procedure. Any help
> would be appreciated.
Run this code (from sp_updatestats) and see what it returns. If it fails
then the user is not a sysadmin and not the dbo in the database. There
is only one dbo per database (they cannot be aliased as dbo I don't
think):
DECLARE @.dbsid varbinary(85)
SELECT @.dbsid = sid
FROM master.dbo.sysdatabases
WHERE name = db_name()
select @.dbsid
select suser_sid()
/*Check the user sysadmin*/
IF NOT is_srvrolemember('sysadmin') = 1 AND suser_sid() <> @.dbsid
BEGIN
RAISERROR(15247,-1,-1)
RETURN (1)
END
David Gugick
Imceda Software
www.imceda.com
|||The Books Online states:
<Excerpt href="http://links.10026.com/?link=tsqlref.chm::/ts_sp_ua-uz_14kz.htm">
Only the DBO and members of the sysadmin fixed server role can execute this
procedure.
</Excerpt>
Note that db_owner role members are not *the* 'dbo'. The database owner is
the login that owns the database.
Hope this helps.
Dan Guzman
SQL Server MVP
"MACason" <MACason@.discussions.microsoft.com> wrote in message
news:47413145-85BC-4F7C-AC60-245E011F324D@.microsoft.com...
>I have a SQL login account defined with DBO permissions on a particular
> database. When this login attempts to run the sp_updatestats stored
> procedure, the following error occurs: "User does not have permission
> to
> perform this action." According to BOL, the DBO has permissions to execute
> this stored procedure. Any help would be appreciated.

No comments:

Post a Comment