Domanda

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)
È stato utile?

Soluzione

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

AND auli.[auliart] NOT  LIKE '' 

Altri suggerimenti

Try using brackets instead on inverted commas like mentioned below

auli.[auliart]

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top