Вопрос

I am having an issue I can not figure out. I created an SSIS package that uses a SQL command to retrieve data from Server2. The query is very simple, however, it references a view in a join. If I execute the SSIS package manually on Server1, it retrieves 925 rows and inserts it into the appropriate table in Server1. The problem starts when I schedule this SSIS package to run nightly. It succeeds on the first step (truncating the table on Server1 in preparation for retrieving the rows from Server2), but, when I look at the table, there are 0 rows. When I modify the Query to remove the join that references a view (getting undesired results), the scheduled SSIS works perfectly, although the recordset I get back is not what I wanted, because I need that JOIN. I don't see how it can be a permissions issue as it works fine without the VIEW. Is there something I'm missing? Thanks for the help.

The following query works only if I execute the SSIS manually: FilteredAccount is a VIEW It should return over 900 rows and does if I run manually, but returns 0 if executing the SSIS via Agent.

SELECT B.epc_cosmid, A.consultant, A.region
FROM Consultant2TC AS A JOIN FilteredAccount AS B ON A.consultant = B.epc_serviceconsultantidname

If I change the query to the one below in the SSIS package and schedule it, it works fine:

SELECT A.consultant, A.region
FROM Consultant2TC AS A
Это было полезно?

Решение

Since you're getting different results from an agent job and your own login, an obvious place to start looking is permissions. What results do you get when you run the query from SSMS while logged in using the agent's credentials?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top