I'm just stuck in with this problem and unfortunately I couldn't find anything to it not even when googling around...
I'm running the following query on a SQL Server 2005 database:
select @TableCount = count(distinct table_name)
from information_schema.columns
And I'm getting different results for @TableCount in different databases, such as:
59,
22,
..etc
BUT when I let my SQL Server Agent run the same query on the same databases he always gets 0 (zero) as the result. I.e. no exception, no error message that something's wrong with his access rights - just simply a 0 (zero) as the result.
Plz help if you have any idea:
- What could be wrong with my SQL Server Agent?
- How comes that I don't get any error message whatever the problem is?
Thx a lot in advance for any ideas / suggestions !!!