I have a database which holds all my permissions and a central database which holds all the logins for all my application. I need to create view that queries both database which reside on the same server. When I am in Sql Server Management Studio I can run the query with no problems. However, when I integrate it into my application I get a run-time exception.
Cannot open database "abc" requested by the login. The login failed.
Login failed for user 'WORKGROUP\HOME$'
The error is obviously the permissions but I don't usually have to give access to this role. If the query is on the same server shouldn't the regular connection string and database permissions be sufficient?