Re: Permission issue with EXECUTE AS



INTP56 (INTP56@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I've been posting in Programming as initially I thought this was a code
problem, but thought I would try here. I've included my script at the end.

Basically, when I run the script logged in as me, everything works as
expected. However, when I run the script logged in as the machine
account SQL Server runs under, I get an error. And the error moves
depending on how I specify the logins. I'm looking for help trying to
track this problem down, as the production server DBA's also create the
databases under a machine account, then let me log in to create the
objects.

There is something fishy going on here. It seems that the domain
account does not have CONTROL SERVER permission, but then again it
create databases and logins and grant permissions, so it does have a
good set of permissions anyway.

Do this: find a database which is not owned by the domain account
and do USE on that database, and then run "SELECT USER". If it says
"dbo", you are sysadmin after all.

But even if you are not sysadmin (that is, have CREATE SERVER), I don't
see why you would have to specify FOR LOGIN. FOR LOGIN should simply
not matter when username and login name are the same. And same goes
for the strange error you get. Had the database been restored from a
different server - but you have just created it.

Just to check: you have SP2 of SQL 2005, haven't you?

If you are able to nail exactly which server-level permissions your
machine has, we might be able to repro it, and maybe then understand
what is going on. Right now, I'm clueless.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • RE: WSS install locked into MSDE DB - Can not install for SQL Serv
    ... For the MASTER database ... Althought we change the Configuration Application pool several times ... interface BUT they appear to be MSDE databases and not SQL Server databases. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: How to Replicate an SQL Server 2000 Database
    ... actual server name) enterprise manager should associate the database with the ... Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.replication)
  • Re: Install MSDE w/ MSDE Depl.Toolkit. What permissions when using Win Auth?
    ... I created a login using Enterprise Manager on SQL Server on my server. ... Database Access tab I ticked the tick box for the database that I ... Now when my user installed the MSDE database on his machine locally, ...
    (microsoft.public.sqlserver.msde)
  • Re: System Administrator Implied Permissions
    ... > sa login, it assigns it the System Administrator fixed ... > Now, given this, why does SQL Server ... in each database is always a member of the public and db_owner roles. ... Other sysadmin role members have the exact same ...
    (microsoft.public.sqlserver.security)
  • Re: No db access after publishing web site
    ... GRANT UPDATE TO ... If I detach and attach this database on a different PC (according that PC ... Cannot open database "pago" requested by the login. ... Are you detaching/attaching the SQL Server Express database correctly ...
    (microsoft.public.dotnet.framework.aspnet)