Never tried this through an ODBC link, but can you use the fully qualified
table name of DATABASE.OWNER.TABLE within the SQL statement?
Instead of
Select count(*) from SomeTable
Try
Select count(*) from OtherDatabase.DBO.SomeOtherTable
(the ".DBO." is a literal, and is typically the default database owner name).
-Tom
--------------------------------------------------------------------------------
From: Servers Alive Discussion List [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, April 28, 2008 9:51 AM
To: Servers Alive Discussion List
Subject: [SA-list] SQL ODBC check
I'm still (!) trying to get to grips with SQL monitoring. I'm using the ODBC
COM check to do it. I've got as far as working out that if I set up an ODBC
connection pointing to a SQL server, with a SQL username that defaults to a
particular database, I can use a SQL statement such as the following:
select count(1) from [tablename]
to check that there are some records in the db (implying that I can connect to
the db ok).
Now, I have many databases on a server, and I need to check that they are all
ok. I guess that I could either set up an ODBC connection for each db (changing
the default to a different database each time), or set up multiple users on the
SQL server (with a different default db for each user). But both of those feel
rather cludgy to me. Is there a way of specifying the default database either
in the SQL statement or in the DSN string?
Thanks,
Ian
_________________________________
Ian K Gray
OEL IS - European Infrastructure Support
Tel: +44 1236 502661
Mob: +44 7881 518854
Ad eundum quo nemo ante iit
______________________________________________________________________________
Any opinions expressed in this email are those of the individual and not
necessarily of the Company. This email and any files transmitted with it,
including replies and forwarded copies (which may contain alterations)
subsequently transmitted from the Company are confidential and solely for the
use of the intended recipient. It may contain material protected by legal
privilege. If you are not the intended recipient or the person responsible for
delivering to the intended recipient, be advised that you have received this
email in error and that any use is strictly prohibited.
Please notify the sender immediately of the error and delete any copies of this
message
Warning: Although the Company has taken reasonable precautions to ensure that
no viruses are present in this e-mail, the Company cannot accept responsibility
for any loss or damage arising from the use of this e-mail or attachments.
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.