Discussion:
User() always returns "dbo" when using MS Access Pass-Thru
(too old to reply)
gbartz
2007-12-12 17:01:02 UTC
Permalink
For my stored procedures, I need to retrieve data based on who the user is,
which I determine using the USER function. My client is an Access
pass-through query with the userid embedded in the connection string.
However, when each stored procedure checks the user id it is usually (not
always) "dbo".

This is a problem which has plagued me and my development team for months.
Does any one know why this is happening and what the solution would be?

We've tried closing Access to break the connection to SQL Server and then
reopening and running the pass through. This occasionally works. We even
have a linked view which simply returns the value of USER. The view will
show the correct user ID which shows that the connection to SQL Server from
Access has the correct user ID. But then, when running the pass-through, the
stored procedure will find that the value of USER is "dbo" instead of the UID
value in the connection string.

Right now, the only work around is to manually run the stored procedures
from Query Analyzer.
gbartz
2007-12-19 15:22:01 UTC
Permalink
We discovered that the problem was with the connection string. We had been
specifying the database (DATABASE=aaa) and that was causing the user to
switch to dbo. Once that clause was removed, the user remained the same as
what was specified in the UID= clause.

Loading...