the below is the error message which i am getting while executing the query in sql Job. but if i execute directly it works fine.
Executed as user: NT AUTHORITY\SYSTEM. XML parsing: line 10, character 33, unexpected end of input [SQLSTATE 42000] (Error 9400). The step failed. Sql Severity 16, Sql Message ID 9400
declare @URL VARCHAR(max) set @url = 'http://www.spa.gov.sa/english/rss.xml' as begin declare @xmlT TABLE ( yourXML XML ) DECLARE @Response nvarchar(max) DECLARE @XML xml DECLARE @Obj int DECLARE @Result int DECLARE @HTTPStatus int DECLARE @ErrorMsg nvarchar(MAX) EXEC @Result = sp_OACreate 'MSXML2.XMLHttp', @Obj OUT EXEC @Result = sp_OAMethod @Obj, 'open', NULL, 'GET', @URL, false EXEC @Result = sp_OAMethod @Obj, 'setRequestHeader', NULL, 'Content-Type', 'application/x-www-form-urlencoded' EXEC @Result = sp_OAMethod @Obj, send, NULL, '' EXEC @Result = sp_OAGetProperty @Obj, 'status', @HTTPStatus OUT INSERT @xmlT ( yourXML ) EXEC @Result = sp_OAGetProperty @Obj, 'responseXML.xml'--, @Response OUT declare @shmNeTlb TABLE ([discp] [nvarchar](max) NULL, [tit] [nvarchar](max) NULL, [datee] varchar(99) NULL, [linkk] [nvarchar](max) NULL) INSERT into @shmNeTlb(discp , tit , datee,linkk) SELECT N.C.value('description[1]', 'nvarchar(max)') discp, N.C.value('title[1]', 'varchar(999)') tit, N.C.value('pubDate[1]', 'varchar(99)') datee,N.C.value('link[1]', 'varchar(999)') linkk FROM @xmlT CROSS APPLY yourXML.nodes('//channel/item') N(C) INSERT into Tlb(FLD369,FLD207,FLD211 , FLD697 , FLD698,FLD256) select @rowId,@sourceId ,discp , tit ,getutcdate()) ,linkk from @shmNeTlb
No comments:
Post a Comment