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 2000 Forums
 SQL Server Development (2000)
 MSXML2.ServerXMLHTTP and Stored Procedures

Author  Topic 

didio
Starting Member

7 Posts

Posted - 2001-06-04 : 09:39:53
Hi,

I've made this stored proc, but it gives me errors and I can't find the problem,
maybe somebody who is seeing what I do wrong..

I get this error:
0x80004005
msxml3.dll
Unspecified error

Here is the stored proc:

CREATE PROCEDURE spPostCodeChecker
@NumZipCodes int
AS

declare
@hr int,
@Object int,
@SubscriberID int,
@Zipcode varchar(6),
@Name varchar(150),
@Email varchar(150),
@Business bit,
@Output varchar(8000)

--Create MSXML2.ServerXMLHTTP object
exec @hr = sp_OACreate 'MSXML2.ServerXMLHTTP', @Object out
if @hr = 0
begin
--Get records
Set RowCount @NumZipCodes
declare curRec cursor for
SELECT SubscriberID, Zipcode, Name, Email, Business FROM vwAnnouncement WHERE Available = 0 AND LastChecked < GETDATE() - 7 ORDER BY LastChecked;

--Looping trough the records
open curRec
fetch next from curRec
into @SubscriberID, @Zipcode, @Name, @Email, @Business
while @@FETCH_STATUS = 0
begin
--Set properties and call send method of the object
exec @hr = sp_OAMethod @Object, 'Open', 'GET', 'http://www.someurl.com', False
exec @hr = sp_OAMethod @Object, 'Send'
exec sp_OAGetProperty @Object, 'ResponseText', @Output out
-- check if everything is oke.
if @hr = 0
begin
print @SubscriberID
update tblAnnouncement set LastChecked = GETDATE() where current of curRec
fetch next from curRec
into @SubscriberID, @Zipcode, @Name, @Email, @Business
end
-- if not, then return error..
else
begin
declare
@src varchar(1000),
@desc varchar(1000)
exec sp_OAGetErrorInfo @object, @src out, @desc out
SELECT hr=CONVERT(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
end
end
close curRec
deallocate curRec
end
--Destroy MSXML2.ServerXMLHTTP object
exec sp_OADestroy @Object
GO


   

- Advertisement -