Calling web service from sql server using sql clr

Problem : In my previous project I was been asked call web service from sql server stored procedure. So I get it done using SQL CLR. So using CLR we can run managed code inside sql server. Code that runs within the CLR is referred to as managed code. We can create stored procedures, triggers, user defined types, and user-defined aggregates in managed code. We can achieve significant performance increases because managed code compiles to native code prior to execution. We can use SQL CLR in in SQL Server 2005 and later. Why Sql CLR in sql server: In some cases some tasks are not possible by T-SQL as my requirement. So in that point we can go with SQL CLR. What tools I have used in this post Visual Studio 2015 Sql Server 2014 In Action: Create SQL Server Database project in VS 2015 Add SQL CLR C# Stored Procedure Name stored procedure As CallWebService 3. Add C# codes

read more Calling web service from sql server using sql clr

Could not load file or assembly ‘Newtonsoft.Json, Version=6.0.0.0, or one of its dependencies. The system cannot find the file specified.

Could not load file or assembly ‘Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the file specified. I got this error when I added to WEB API to ASP.NET MVC project. So This is how I get it solved Run this command in package manager console Update-Package –reinstall Newtonsoft.Json  

MERGE in Sql Server

From Sql server 2012 we can merge two tables. We can map data from one table to another table. If record exists can do a update and if not insert operation can be done. Syntax Create two tables and Insert some records Then do Merge Now view TargetTable Data