In SQL Server I have defined the following Job agent and the following step:
INSERT INTO dse.dwh_log
SELECT *
FROM
OPENQUERY(DWH_Production,
'
select
cast(cast(LogonDate as format ''yyyy-mm-dd'') as char(10)) || '' '' ||
cast(cast(LogonTime as format ''99:99:99.999'') as char(12)) as LogonTime,
UserName,
substr(StatementText,1,8000) as RequestText
from
p_sys_ms_logging.accesslog_hst
where statementtype = ''select''
and databasename in (''CDR'', ''cdr30_targetdb'')
and statementtext is not null
and logondate > current_date - 2')
The error message I am getting is:
Executed as user: XYZ. An error occurred while preparing the query select cast(cast(LogonDate as format 'yyyy-mm-dd') as char(10)) || ' ' || cast(cast(LogonTime as format '99:99:99.999') as char(12)) as LogonTime, UserName, substr(StatementText,1,8000) as RequestText from p_sys_ms_logging.accesslog_hst where statementtype = 'select' and databasename in ('CDR', 'cdr30_targetdb') and statementtext is not null and logondate > current_date - 2"
for execution against OLE DB provider "MSDASQL" for linked server "DWH_Production".
[SQLSTATE 42000] (Error 7321).
NOTE: The step was retried the requested number of times (2) without succeeding. The step failed.
The duration is about an hour, but the query should run in around 5 minutes. I am retrieving the data from the Teradata database, and transferring them to SQL Server.
Does anyone know why am I getting this message (on Google I did not find anything that could help me), and what I should do to fix it?
Aucun commentaire:
Enregistrer un commentaire