call a web service from T-SQL in Sql Server 2008 - sql-server

Is there a way to call a HTTP web service from T-SQL (no SQLCLR) in Sql Server 2008? I just need to send information out, I do not need to receive anything into T-SQL.
Thanks.

You can automate the XMLHTTP server object using the Object Automation extended stored procedures.
Example here
I suggest you use the CLR or an SSIS package though.

If you are doing this in a sproc, then you could create a tiny VB program and use
exec sp_cmdshell 'c:\path\myapp.exe'
to call your program. Technically its not CLR embedded in SQL Server right? :)

The Web Service Task should allow you to do that.
Web Service Task
How to: Call a Web Service by Using the Web Service Task (SQL Server Video)
I'm assuming you are doing this from an "intergration services" package

Related

Generate REST API from SQL Server database

Is it possible to generate a REST API from an existing SQL Server database?
I'm using Visual Studio and SQL Server on Azure.
How would I do this?
There is no direct way to do this. But you can achieve in two ways
(i) Using external applications like DreamFactory
(ii) Write your own code to interact with SQL using c# with any entity framework, or even using javascript language

Azure SQL Automation stored procedures

I am migrating on premises SQL server database to Azure PaaS SQL database using Data Migration Tool. I am not using Data Migration Service Instance mechanism to migrate the database as it would require VPN on the corporate network and I do not see any benefit doing that way in my case.
There is one error which I am stuck on and a bit confused. When migrating a stored procedure which use automation stored procedures, I get the following error:
When I run Alter procedure script directly on Azure SQL database , I get this error;
Reference to database and/or server name in 'MASTER..sp_OACreate' is not supported in this version of SQL Server.A few answers to similar question on stackoverflow suggest that Azure SQL does not support automation stored procedures but the Microsoft link has a green tick against Azure SQL which suggest it does; https://learn.microsoft.com/en-us/sql/relational-databases/stored-procedures/ole-automation-sample-script?view=sql-server-2017.
A snippet of the sp is:
Is it true that automation stored procedures are not supported in Azure SQL and if thats hte case then what is hte workaround apart from rewriting the sp?
SQL Azure prevents you from calling server resources. sp_OACreate attempts to create a reference to an OLE object on the server; that's simply not allowed on Azure SQL Database. So you will need to redesign your solution to move this type of logic in a middle-tier of some kind, such as a Web Role in Windows Azure.

Connect to a webservice from SQL

SQL Server is able to open excel sheets (xlsx), access databases (mdb) and other data streams using data providers (e.g. JET, ACE) and OPENROWSET.
Are there similar facilities to extract data from a remote webservice ? Using OPENROWSET and providing it a web service driver and URL and some schema definition to translate the hierarchical nature of the webservice XML output into a table that SQL Server can query on.
I'm thinking of something like:
select * from
OPENROWSET('WEBSERVICE.4.0.PROVIDER','http://mydomain/webservice.asmx')
That's a high level question, although I know it's conceptually possible, I'd like to know if there are any implementations of this idea.
Thanks
You could use a SQL-CLR assembly (in versions 2005 or newer) to handle the calling of the stored procedure, and to insert the data into your SQL Server database table.
See some of these tutorials (plenty more when you Google or Bing for it):
CLR Stored Procedure Calling External Web Service - SQL Server 2005 Tutorials
Consuming a Web Service from a SQL Server 2005 CLR Assembly
Query a web service with SQLCLR
Invoking a Web Service from a SQLCLR Stored Procedure
Calling a Web Service from within SQL Server
How to consume a web service from within SQL Server using SQL CLR

Sync Framework: Can I synchronise Stored Procedure

Does the sync framework allow me to synchronise (download only) the Store Procedures on a sql server 2008 server with the Stored procedures on the SQL Server 2008 client?
i.e. overwrite the SP on the client when the server SP's have been modified or new ones created?
No you cant do that, The Sync Framework is designed to sync data from server to a users pc and back again. While it can synchronize between servers, you are better off using SQL2008 replication engine, or a 3rd party API, such as Redgates SQLcompare, which you can operate programatically.
Microsoft Sync Framework is used to synchronize data not the database schema or the periphery. Generally speaking, this is an application update issue.

How can I export my MS Access Data to SQL Server?

I have a MS Access database and I want to convert it to run on MS SQL Server.
How can I export it?
You can also use SQL Server Integration Services to import into SQL Server (2005), rather than export.
Tools.. Options... Upsizing Wizard, if I recall correctly.
Strictly speaking, you'll always need software to do it, unless you have 3 wishes from the ETL fairy.
If your SQL Server is SQL Server 2000 or SQL Server 7, SQL Server Integration Services mentioned by Miles D was calles Data Transformation Services. By the way: I love this tool. It's awesome.
If for some reason you can't (or don't want to) use any of these tools, you could always write a very short piece of code (in Java, C# or whatever you feel comfortable with) to accomplish the same thing for your specific problem.
Use the free Microsoft SQL Migration Assistant for Access (SSMA): it's purpose is to convert Access apps to SQL: it's great and it's free.
I wrote a blog post about it:
http://blog.nkadesign.com/2009/ms-access-upsizing-to-sql-server-2008/

Resources