SQL Server to Azure Cosmos DB Migration - azure

Please let me know whether we can migrate stored procedure from Microsoft SQL server to Microsoft Azure Cosmos DB ?
Either with DocumentDB migration tool or any other tool

There's really no direct correlation between the two: Stored procedures within the two databases are completely different. No possible way to migrate them, aside from you doing a complete rewrite. SQL Server stored procedures are written in SQL, vs Cosmos DB's JS-based stored procedures. Plus there is the notion of partitions, context, etc.
And Cosmos DB doesn't offer SQL Server compatibility and isn't a relational database. The Core (SQL) API takes advantage of SQL query language, but only for queries.

Related

Enlisting a Cosmos transaction in a Sql Server Database Transaction

We are using Entity Framework Core 3 and Cosmos 3.4 with Sql API.
Is it possible to enlist a Cosmos (Microsoft DocumentDb) transaction in a Sql Server Transaction so that the RollBack/Commit applies to Both Sql Server and the Cosmos.
Many thanks
Cosmos DB has no transactional support outside of Cosmos DB itself. Its transactions are either at the document level (e.g. inserting a document) or at a stored procedure level (e.g. modifying several documents within the stored procedure, which takes place within a single partition of a single collection).
There's no way to have actual transactional commit/rollback connected with SQL Server (or any other database) outside of Cosmos DB. You'd need come up with your own strategy for keeping data in sync between the two databases.

Cross Database Queries are possible

Can I do cross database queries from a Azure SQL Database to Azure SQL Data warehouse, I read somewhere that its possible around sql databases but can it be possible in azure datawarehouse and sql database.
It is a "thing" with MS SQL databases, achieved via links using special credentials and external tables (which essentially map a foreign DB's tables to the local DB). It didn't used to be possible in Azure, but it is nowadays.
For more info, see here

Is it possible to use Cosmos DB instead of Azure SQL DATABASE?

I am very excited to use Cosmos DB into my current application instead of Azure SQL database.
Before use Cosmos DB as backend in my current application, I have few questions in my mind those are
In my current application I used Entity framework.
And also used column encryption, dynamic data masking features.
So, if I moved to Cosmos DB instead of using Azure SQL database then how can I achieve those features by using Cosmos DB?
Documentation doesn't specify details about encryption, masking and entity framework.
Can you please tell me “is it possible to use Cosmos DB with above requirements instead of Azure SQL Database?
Entity Framework is specific to relational databases, so it doesn't fit with Cosmos DB's document store (or graph, or tables).
Regarding encryption: Cosmos DB provides encryption-at-rest, built-in. There is no per-property data-masking feature built-in; you'd have to do your own data masking.
Whether you migrate to a document (or graph, or table) store is really up to you, and whether you want to re-shape your data to fit in such a storage model, vs a relational model. No real way to answer that for you. (TL;DR you cannot just switch from relational to, say, document, without any changes, as they are fundamentally different storage concepts).

LINQ to SQL with SQL Azure

We are investigating moving to a cloud model and the Microsoft Azure PaaS platform.
Our current data layer is written using LINQ to SQL. Will it be compatible with SQL Azure?
Yes LINQ to SQL is compatible. But you have to keep 2 things in mind:
SQL Azure is not a dedicated machine for you alone. Your databases will run on machines with other customers. You may be throttled, you can encounter transient exceptions, ... That's why you should implement a retry policy. There's an article on TechNet explaining how to do this with LINQ to SQL.
Since SQL Azure is not a real SQL Server there are some limitations. Read all about those limitations here: General Guidelines and Limitations (Windows Azure SQL Database). If you're planning to move an existing database (with or without data) to SQL Azure, consider using a tool that supports SQL Azure like the SQL Database Migration Wizard (SQLAzureMW).

Can't query between databases in SQL Azure

I have a SQL Azure Database Server and I need to query between the Databases but can't figure out how to accomplish this.
Here is the structure of my databases:
Server.X
Database.A
Database.B
Database.C
In Database.A I have a Stored Procedure that needs to retrieve data from Database.B. Normally, I would reference the database like SELECT * FROM [Database.B].[dbo].[MyTable] but this does not appear to be allowed in SQL Azure.
Msg 40515, Level 15, State 1, Line 16
Reference to database and/or server name in 'Database.B.dbo.MyTable' is not supported in this version of SQL Server.
Is there a way to do this on the database end?
In the final version Databases A & C will both need data from Database B.
Update:
As per Illuminati's comment and answer, the situation has changed since this answer was originally accepted and there is now support for cross database queries as per https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/
Original Answer (2013):
Cross database queries aren't supported in SQL Azure. Which means you need to either combine the databases to prevent the need in the first place, or query both databases independently and basically join the data in your application.
Cross database queries are now supported in SQL Azure
https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/
Azure SQL DB is previewing Elastic Database Query feature at this point in time that will help you query among Azure SQL DBs with some limitations. You can get detailed information about the feature here.

Resources