Question

I tried to create an SQL Server Agent Task that executes this command:

use PPTEST
Update PPTEST.dbo.T_AUAU
SET PPTEST.dbo.T_AUAU.auaulart = auli.auliart
From PPTEST.dbo.T_AUAU auau
INNER JOIN
    PPTEST.dbo.T_AULI auli
on
    auau.auauaunr = auli.auliaunr
where CONVERT(date, LEFT(auli.timest, 10 )) >= CONVERT(date, getdate()) 
AND CONVERT(time, SUBSTRING(auli.timest, 12, 8 )) > CONVERT(time, DATEADD( hour, -1, getdate()))
AND auli."auliart" NOT  LIKE '' 

It works fine if I start the Query manually, but the Server Agent throws following exception:

Wrong Syntax next to 'auliart' [SQLSTATE 42000] (Error 102)
Was it helpful?

Solution

Use [ and ] as column separators insted of the quotes ("):

AND auli.[auliart] NOT  LIKE '' 

OTHER TIPS

Try using brackets instead on inverted commas like mentioned below

auli.[auliart]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top