Call web service from SQL CLR?

后端 未结 2 540
青春惊慌失措
青春惊慌失措 2020-12-06 12:28

I have a SQL Server 2012 stored procedure that returns a table. I have to modify that SP to add an additional value to the returned table. Unfortunately, that added value co

2条回答
  •  囚心锁ツ
    2020-12-06 13:30

    You can definitely call a WCF service using SQL CLR.

    If you don't want that, you could write a Windows Service in C# that watches or polls the table for changes. Depending on how you implement this service, the reaction to a new record would be near immediate. Read also How to notify a windows service(c#) of a DB Table Change(sql 2005)?.

    Then you can perform the service call from C#, perform the required work and store the result in the column.

    When you require more information, for example extra variables obtained during the exchange, you could introduce a new table for storing that, and the actual result you're interested in. Then join that table from the table in your question.

提交回复
热议问题