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.
Author |
Topic |
vijay1234
Starting Member
48 Posts |
Posted - 2014-10-01 : 04:06:31
|
Hi all,I have a requirement to call web services from a stored procedure.That was achieved from the following stored procedure ________________________________________________________USE [AdventureWorks2008R2]GO/****** Object: StoredProcedure [dbo].[usp_callwebservice] Script Date: 10/01/2014 12:58:39 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER procedure [dbo].[usp_callwebservice]@location nvarchar(200) = NULLas begindeclare @obj intdeclare @url nvarchar(200)declare @response varchar(8000)declare @xml XMLset @url = 'http://maps.googleapis.com/maps/api/geocode/xml?address='+@location+'&sensor=false';exec sp_oacreate 'MSXML2.ServerXMLHTTP', @obj OUTexec sp_OAMethod @obj,'open',NULL,'GET',@url,falseexec sp_oamethod @obj,'send'exec sp_OAGetproperty @obj, 'responsetext', @response OUTselect @xml= CAST(@response as XML)select @xmlexec sp_OADestroy @objreturnend _______________________________________________________________I would like to create an after insert and after update triggers on this stored procedure in one single code.Can some one help me out with the requirement please.Here the location is the input parameter with XML as the output.Thanks,Vijay |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-10-01 : 04:35:31
|
Triggers can be created on Tables/Views, not on stored procedures.As an alternative, you can insert an entry in some table after web service call. You can then create trigger on that table after each insert.Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
|
|
|
|
|