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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multi database recordset

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-06 : 10:03:55
Damon writes "Is it possible to create a recordset in an ASP page from tables in multiple databases? What would the syntax be?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-06 : 11:09:34
Sure. If you are building the SQL string in ASP (see notes below), you need to use the fully-qualified naming convention:

SELECT * FROM database.owner.table

Usually this can be abbreviated to:

SELECT * FROM database..table

An example:

SELECT * FROM db1..tableA A INNER JOIN db2..tableB B ON (A.ID=B.ID)

You are better off NOT building the string in ASP. Instead, create a view or stored procedure on your SQL Server that includes these SELECT statements, and then SELECT the view or EXECUTE the stored procedure from your ASP page.

Go to Top of Page
   

- Advertisement -