Q
Problem solve Get help with specific problems with your technologies, process and projects.

Cross database access when executing stored procedures

Executing a stored procedure that draws from tables on other databases requires the option of cross-database ownership chaining. SQL Server development expert shares what you'll need to investigate this server option.

In VB.NET, I am trying to execute a stored procedure that tries to insert values into a table using a SELECT statement. The SELECT statement uses tables from this database and also uses a view containing this database's tables and a table from a different database. When I try to execute the procedure, I get an error message that the user ID in my connection string does not have rights to the different database. What would be the solution to this problem?
The thing to investigate here that will allow access across databases is cross-database ownership chaining. The behavior of this function was modified in SQL Server 2000's Service Pack 3. Take a look at the entry in Books Online called "Cross DB Ownership Chaining option." Make sure you have an updated copy of Books Online too.
This was last published in August 2006

Dig Deeper on SQL Server Stored Procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close