Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 80
  • Last Modified:

SQL Stored procedure

I have created a SQL Stored procedure in DatabaseA and it need to refer some tables stored in DatabaseB on the same server. What's the best way to reference those tables ?

Tks
0
AXISHK
Asked:
AXISHK
2 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
you can prefix with the database name:

select * from DatabaseB.dbo.tableName
0
 
HuaMinChenBusiness AnalystCommented:
Hi,
Try
insert tab1 (...)
select ...
from DatabaseB.dbo.table2

Open in new window


to refer to the table on other DB
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now