kkbenj
asked on
SQLSTATE 42000 (Error 102) Incorrect syntax near 'ltv'
I'm new to SQL Server Agent and set up a job to run a query string that runs successfully in the query window.
It is a Transact-SQL script (T-SQL) type.
Can someone kindly educate to as to what is wrong? Thanks in advance.
It is a Transact-SQL script (T-SQL) type.
Delete from lookuptablevalues ltv
where ltv.keyvalue in
(
select distinct(si.value_ci) collate Latin1_General_CI_AS keyvalue
from recipientlists rl, recipientstringvalues rsv, rv_stringindex si, lookuptablevalues ltv,
recipientdatevalues rdv
where
rsv.recipientid = rl.recipientid
and rl.recipientid = rdv.recipientid
and rsv.fieldid = 1462
and rl.listid=5773
and si.id = rsv.valueid
and ltv.lookupid=193
and ltv.keyvalue = si.value_ci collate Latin1_General_CS_AS
and rdv.value < getdate()-7
)
Can someone kindly educate to as to what is wrong? Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER