MSSQL returned: Invalid object name
MSSQL returned: Invalid object name
am 23.03.2007 15:38:38 von Alf C Stockton
I have a php script where I need to access tables in two different MSSQL
databases.
The scenario is ..... access 1st database to retrieve data that will be
used when calling a StoredProcedure within the 2nd database which will
return data with which one can access the 1st database to retrieve more
data.
If I do both calls to the 1st database by hardcoding info from 2nd
database all works well but if I access 1st, call StoredProcedure then
attempt to do a select back on the 1st I get :-
MSSQL returned: Invalid object name 'EarnRate'
EarnRate is an existing table in 1st database.
Please help.
--
Regards,
Alf Stockton www.stockton.co.za
Q: What do you call a principal female opera singer whose high C
is lower than those of other principal female opera singers?
A: A deep C diva.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MSSQL returned: Invalid object name
am 23.03.2007 18:42:20 von frank
This sounds like your MSSQL connections are getting mixed up.
If the two databases are on the same server and the same sql login has
access to both databases you can query everything from a single conenction.
You just have to qualify the tables/procedures with ..table
to the server knows where to look.
If you need two different connections and the host/user and passwords are
the same you must tell mssql_connect to force a new connection. Set the
optional forth parameter to true.
- Frank
> I have a php script where I need to access tables in two different MSSQL
> databases.
> The scenario is ..... access 1st database to retrieve data that will be
> used when calling a StoredProcedure within the 2nd database which will
> return data with which one can access the 1st database to retrieve more
> data.
>
> If I do both calls to the 1st database by hardcoding info from 2nd
> database all works well but if I access 1st, call StoredProcedure then
> attempt to do a select back on the 1st I get :-
> MSSQL returned: Invalid object name 'EarnRate'
> EarnRate is an existing table in 1st database.
> Please help.
>
> --
> Regards,
> Alf Stockton www.stockton.co.za
>
> Q: What do you call a principal female opera singer whose high C
> is lower than those of other principal female opera singers?
> A: A deep C diva.
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MSSQL returned: Invalid object name
am 24.03.2007 10:50:22 von Alf C Stockton
Frank M. Kromann wrote:
> This sounds like your MSSQL connections are getting mixed up.
>
> If the two databases are on the same server and the same sql login has
> access to both databases you can query everything from a single conenction.
> You just have to qualify the tables/procedures with ..table
> to the server knows where to look.
>
> If you need two different connections and the host/user and passwords are
> the same you must tell mssql_connect to force a new connection. Set the
> optional forth parameter to true.
>
To be a little more clear the scenario is as follows
connect and use DB1 to get data for Stored Procedure
connect and use DB2 via Stored Procedure getting data that can be used to
get more data from DB1........and this is the one that fails.
Frank, I have tried your suggestions unfortunately without success.
--
Regards,
Alf Stockton www.stockton.co.za
Q: How many Harvard MBA's does it take to screw in a light bulb?
A: Just one. He grasps it firmly and the universe revolves around him.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MSSQL returned: Invalid object name
am 24.03.2007 15:00:14 von Alf C Stockton
Alf Stockton wrote:
> Frank M. Kromann wrote:
>> This sounds like your MSSQL connections are getting mixed up.
>>
>> If the two databases are on the same server and the same sql login has
>> access to both databases you can query everything from a single
>> conenction.
>> You just have to qualify the tables/procedures with
>> ..table
>> to the server knows where to look.
>>
>> If you need two different connections and the host/user and passwords are
>> the same you must tell mssql_connect to force a new connection. Set the
>> optional forth parameter to true.
>>
> To be a little more clear the scenario is as follows
>
> connect and use DB1 to get data for Stored Procedure
> connect and use DB2 via Stored Procedure getting data that can be used to
> get more data from DB1........and this is the one that fails.
>
> Frank, I have tried your suggestions unfortunately without success.
>
The solution was to use ..table on the offending select
statement when I eventually coded that line correctly.....:-(
Thank you.
--
Regards,
Alf Stockton www.stockton.co.za
You will experience a strong urge to do good; but it will pass.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php