Announcing SQL Server to Snowflake Migration Solutions

by Brandon Carver, on Mar 17, 2022 5:33:57 AM

It's Spring (or at least it will be soon), and while nature may take the Winter off from growing its product, Mobilize.Net did not. As Snowflake continues to grow, SnowConvert continues to grow as well. Last month, Mobilize.Net announced SnowConvert for Oracle, the first follow-up to the immensely popular SnowConvert for Teradata. This month? It's time for SnowConvert for SQL Server

SnowConvert-for-SQL-1

SQL Server has been Microsoft's database of choice since before Windows was in existence. It has provided a lightweight option for thousands of application's back-end, and has evolved to be a comprehensive database platform for thousands of organizations. As an on-premise solution, SQL Server carried many developers and organization through the 90s and early 2000s. But like other on-prem solutions, the cloud has come. Even Microsoft has taken its database-ing to the cloud through Azure and Synapse. However, Snowflake has taken the lead as the Data Cloud, and SnowConvert is the best and most popular (did we mention it's converted 500 million lines of code?) way to help you get there. 

If you have SQL Server, I would hope the SQL you have written for SQL Server is not quite as old as the first version of Windows. But even if it is and the architects of that original SQL are nowhere to be found anymore, SnowConvert's got you covered. SnowConvert automates any code conversion of any DDL and DML that you may have to an equivalent in Snowflake. But that's the easy part. The hard problem in a code migration for databases is the procedural code. That means Transact SQL for MSSQL Server. And with T-SQL, SnowConvert again has you covered.

Procedures Transformed

SnowConvert can take your T-SQL to functionally equivalent JavaScript or Snowflake Scripting. Both our product page and documentation have more information on the type of transformation performed, so why not show you what that looks like on this page? Let's take a look at a really basic procedure from the Microsoft Adventure Works database and convert it into functionally equivalent JavaScript. This is a procedure that does an update to a table: 

CREATE PROCEDURE [HumanResources].[uspUpdateEmployeePersonalInfo]
@BusinessEntityID [int],
@NationalIDNumber [nvarchar](15),
@BirthDate [datetime],
@MaritalStatus [nchar](1),
@Gender [nchar](1)
WITH EXECUTE AS CALLER
AS
BEGIN
SET NOCOUNT ON;

BEGIN TRY
UPDATE [HumanResources].[Employee]
SET [NationalIDNumber] = @NationalIDNumber
,[BirthDate] = @BirthDate
,[MaritalStatus] = @MaritalStatus
,[Gender] = @Gender
WHERE [BusinessEntityID] = @BusinessEntityID;
END TRY
BEGIN CATCH
EXECUTE [dbo].[uspLogError];
END CATCH;
END;

Pretty straightforward in SQL Server. But how do you replicate this functionality in JavaScript automatically? Of course, by using SnowConvert. Here's the output transformation:

CREATE OR REPLACE PROCEDURE HumanResources.uspUpdateEmployeePersonalInfo (BUSINESSENTITYID FLOAT, NATIONALIDNUMBER STRING, BIRTHDATE DATE, MARITALSTATUS STRING, GENDER STRING)
RETURNS STRING
LANGUAGE JAVASCRIPT
EXECUTE AS CALLER
AS
$$
// REGION SnowConvert Helpers Code
// This section would be populated by SnowConvert for SQL Server's JavaScript Helper Classes. If you'd like to see more of the helper classes, fill out the form on the SnowConvert for SQL Server Getting Started Page.
// END REGION

/*** MSC-WARNING - MSCEWI1040 - THE STATEMENT IS NOT SUPPORTED IN SNOWFLAKE ***/
/* SET NOCOUNT ON*/
;
try {
EXEC(` UPDATE HumanResources.Employee
SET NationalIDNumber = ?
, BirthDate = ?
, MaritalStatus = ?
, Gender = ?
WHERE BusinessEntityID = ?`,[NATIONALIDNUMBER,BIRTHDATE,MARITALSTATUS,GENDER,BUSINESSENTITYID]);
} catch(error) {
EXEC(`CALL dbo.uspLogError(/*** MSC-WARNING - MSCEWI4010 - Default value added ***/ 0)`);
}
$$;

SnowConvert creates multiple helper class functions (including the EXEC helper called in the output procedure) to recreate the functionality that is present in the source code. SnowConvert also has finely tuned error messages to give you more information about any issues that may be present. You can actually click on both of the codes in the output procedure above to see the documentation page for that error code.

Want to see the same procedure above in Snowflake Scripting? Interested in getting an inventory of code that you'd like to take the cloud? Let us know. We can help you get started and understand the codebase you're working with. If you're already familiar with SnowConvert in general, SnowConvert for SQL Server has all the capabilities that you've come to expect. From the ability to generate granular assessment data to functionally equivalent transformations built upon a semantic model of the source code, SnowConvert for SQL Server is ready to see what you can throw at it. Get started today!

Get Started with SnowConvert for SQL Server

SnowConvert-launch-rocket-1600x900

Topics:JavaScriptdata modernizationmigration servicesSnowflakesql conversioncloud-data-warehousedataassessmentSQL Server

Comments

Subscribe to Mobilize.Net Blog

More...
FREE CODE ASSESSMENT TOOL