MSSQL cross-database Queries
Posted: 19.10.2006, 23:27
Hi again folks,
Today I wrote a query that references another database - other than the one in TZConnection.Database
If I execute it from a dinamically created TZQuery component, I get the following error :
There's a commonly used manager program for MS SQL Server 2000. It's called EMS SQL Manager for SQL Server. If I copy-paste the query into this program, it runs fine, gives expected results. This (commercial) program is probably using Zeos also, because it has the same 'busy' cursor than Zeos displays if you set TZConnection.SQLHourGlass to true.
Therfore it's very likely that it's possible to do this with Zeos.
To resolve the problem, I've tried to empty the database property from ZConnection and put exact database references before each table name in the query, but it gave me the same error.
I was also searching in the MSSQL manual, but found nothing about connections and databases, but this is the expected case from Microsoft Corp.
So can anybody tell me please, how can I access two MSSQL databases from one ZQuery on one ZConnection ?
Thank You.
Cheers,
Peter
Today I wrote a query that references another database - other than the one in TZConnection.Database
Code: Select all
SELECT Rendszam,FszgA,FszgB,CI
FROM Online FULL OUTER JOIN BUSDATADKV.dbo.Jarmu
ON (BUSDATADKV.dbo.Jarmu.FSZGA=Online.CI) OR (BUSDATADKV.dbo.Jarmu.FSZGB=Online.CI)
WHERE CI=999 OR BUSDATADKV.dbo.Jarmu.FSZGA=999 OR BUSDATADKV.dbo.Jarmu.FSZGB=999 ORDER BY Rendszam ;
Code: Select all
General SQL Server error: Check messages from the SQL Server.
The database name component of the object qualifier must be the name of the current database.
Therfore it's very likely that it's possible to do this with Zeos.
To resolve the problem, I've tried to empty the database property from ZConnection and put exact database references before each table name in the query, but it gave me the same error.
I was also searching in the MSSQL manual, but found nothing about connections and databases, but this is the expected case from Microsoft Corp.
So can anybody tell me please, how can I access two MSSQL databases from one ZQuery on one ZConnection ?
Thank You.
Cheers,
Peter