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.
Related
I am connecting to and running queries on an Azure database (S4) which I connect to through SQL Server Management studio on my Windows 10 laptop. I have a complicated query I am running that gives me an select output after about 5 hours but since the database is so large any network problem causes me to get a transport error and lose any output I would have gotten.
if this happened with an on-premises database I would simply put the query in a SQL Server Agent job. But when connecting to an azure database instance I don't see any sql server agent in the Azure instance for me to add a query to.
I would like to be able to run a long running query remotely on a SQL Server Azure database without being dependent on stable network connection
Put those queries on a stored procedure and then use Azure Automation to schedule the execution of the stored procedure. In this StackOverflow thread I show step-by-step how to schedule execution of a stored procedure on Azure SQL Database using Azure Automation.
Also an Azure VM jump box in the same region as your database is commonly used for stuff like this.
The question: Is it possible to point a view in database A running on Azure SQL Database service to tables/views on a SQL server running in a VM? I've tried external tables but come up short.
Scenario:
Two applications that is exchanging data, from two different vendors.
We've got three databases in total. One for each application and an integration database with views that both applications use either directly or through views.
The issue now is that we want to migrate to Azure and would prefer to use the Azure SQL Database service as much as possible, but one of the applications is not ready for it and therefor it's database has to be hosted on either a managed instance or in a VM.
The issue now is that there's view's in database A (running on Azure SQL Database service) that points to views and tables in the integration database, which again references tables in database B (running on SQL Server on the VM).
The short answer is "no". You can use external tables to query other SQL Azure databases, but there is no exact analogue for linked servers in Azure SQL Database. You can use SQL Azure Managed Instance (which supports SQL-SQL linked servers but not arbitrary linked servers).
There is a workaround, however. You can run SQL Server in an Azure VM and have it point to SQL Azure as a target as well as the other sources you want to connect. Then you can push data to/from Azure SQL DB using the SQL Server in a VM. You don't have the same management overhead in this approach since you don't really need to host data in the SQL Server if you don't want to do so. Note that this will be slower than doing direct connections to SQL Azure, but you can try to do this for a period of time if it would help you during a migration.
I am trying to publish a SQL Server database using a .dacpac and publish profile to an Azure SQL database. We have been using on premises SQL Server with no problems for quite some time, and now we are evaluating Azure and AWS to see which is best suited for our needs.
We have a SQL Server database project and want to deploy it to Azure SQL database, however it fails to execute the script generated by SSDT. This is because the generated script contains a call to the stored procedure sp_MSforeachtable which does not exist in Azure SQL.
I also have changed the target platform from SQL Server 2016 to Azure SQL V12. I am trying this from Visual Studio 2017's publish profile and from VSTS Release management using Azure SQL database deployment task. An of course by providing the necessary .dacpac and publish.xml files in the task.
I know I can manually add the stored procedure, however it doesn't seem that is what is intended by these publishing/deployment methods. Does anyone have any ideas?
Thanks
sp_MSforeachtable is an undocumented stored procedure in the Master database. This apparently hasn't been ported over to Azure SQL. I believe you'll need to add it manually to the Master database. Once that is done, your DACPAC should work just fine on your own Azure SQL database. I don't see a problem with manually adding sp_MSforeachtable. DACPACs are meant to keep your database in sync, not the Master database.
This feature is not implemented in SQL Database in Azure.
You can find a copy of it at this location: https://gist.github.com/metaskills/893599
Correct, sp_MSforeachtable stored procedure is still missing in Azure SQL, but you can easily create it manually. It is very helpful when you have to rebuild indexes for all tables at once:
exec sp_MSforeachtable #command1="DBCC DBREINDEX ('?', '', 80)"
I understand that there are a few threads existing on this area, around a local server using Azure MSSQL as a linked DB.
My specific issue is the linked server appears, connects and I can view the databases but when trying to go deeper, as in see the tables I get the following error:
Reference to the database and/or server name in
'databasetable.sys.sp_tables_rowset2' is not supported in this version
of SQL Server. (Microsoft SQL Error, Error 40515).
I have tried any of the suggestions already mentioned via the other threads, and to no avail can I get any deeper than listing the databases on the Azure server from my local installation of SQL Server.
I experience the same issue when trying to do anything more than simple Select/Insert/update/delete/create Table/Drop table on my SQL Azure databases. It appears you cant do anything that touches the settings of SQL Server or any stored procs that touch system tables, perhaps because the SQL servers could be shared between multiple customers.
There are also documented areas where Azure SQL has limitations versus a local SQL Server.
We now have this capability using elastic database query, you need to follow two simple steps mentioned as:
Step-1: Create reference to external database
Step-2: Then create remote table reference in the target database
then you can execute remote queries just the way you do it with SQL Server.
Please refer for step by step details https://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-query-getting-started-vertical/
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