Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL server Agent job failure

Author  Topic 

ultrajounin
Starting Member

1 Post

Posted - 2011-10-28 : 14:34:13
I am not a DBA, just a system admin trying to run a fairly basic query which I want automated.

SELECT ref_num, DATEADD(second, call_req."open_date", '12/31/1969 20:00:00') AS open_date,
(SELECT userid
FROM ca_contact
WHERE (contact_uuid = call_req.assignee)) AS assignee
FROM call_req
WHERE (status = 'OP') AND (assignee <> 'NULL')
--and call_req.open_date < 1309478400
ORDER BY assignee DESC

------------Open Requests----------------------
SELECT c.name, a.userid
FROM ca_contact a
inner join call_req b on a.contact_uuid = b.assignee
left outer join ca_resource_department c on a.department=c.id
where b.status = 'OP' AND b.assignee is not null
--and b.open_date < 1309478400
group by a.userid, c.name
ORDER BY c.name, a.userid DESC


Ive created a tsql job which parse fine (and runs fine independently) but when I "start job step" or it runs on schedule it fails with the following error:

10/28/2011 14:07:57,Open Requests HD data,Error,1,DBSERVER,Open Requests HD data,run query for data,,Executed as user: NT AUTHORITY\SYSTEM. Incorrect syntax near 'open_date'. [SQLSTATE 42000] (Error 102) Incorrect syntax near the keyword 'AS'. [SQLSTATE 42000] (Error 156). The step failed.,00:00:00,15,156,,,,0

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-29 : 01:20:11
i dont think error is in posted code above. is this only step in job which is failing?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -