Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sp to access table in another db

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2008-09-08 : 07:21:26
I have an sp in DatabaseA. I want it to list data from DatabaseB. I am trying to do this in asp.net. It says it cannot find the sp if I use connection string to DatabaseB. It will not list the data if connection string is to DatabaseA

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-08 : 08:53:14
Refer the DB in the SELECT statement

SELECT columns from DatabaseB.dbo.table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2008-09-08 : 09:13:14
I found that after all - now I'm getting this error so have referred to the db administrator to alter permissions.....
The server principal "XXXReg" is not able to access the database "PUBS" under the current security context
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2008-09-08 : 11:26:46
If I change my sp to a sql statement in the code it works ok........it's a asp web app -should I post on an asp.net site ?
Go to Top of Page
   

- Advertisement -