How to Export Azure Synapse Table to Local CSV using BCP?

It is common practice to offload large table to a flat file such as CSV, TSV or fixed width files. Many application stores data in the form of flat files such as CSV. Managing flat files such as CSV is easy and it is easy to transport using any electronic medium. In this article, we will check how to export Azure Synapse table to local CSV using BCP command? In my other article, we have discussed how to export an Azure table to local CSV using SQLCMD command. Azure Synapse…

Continue ReadingHow to Export Azure Synapse Table to Local CSV using BCP?
Comments Off on How to Export Azure Synapse Table to Local CSV using BCP?

How to Load Local File to Azure Synapse using BCP?

It is common practice to offload large table to a flat file such as CSV, TSV or fixed width files. Managing flat files such as CSV is easy and it is easy to transport using any electronic medium. In this article, we will check how to load or import local flat file to Azure Synapse using the BCP command with some examples. Load Local Flat File to Azure Synapse using BCP Utility The bulk copy program utility (bcp) bulk copies data from a file in a user-specified format to an instance such as…

Continue ReadingHow to Load Local File to Azure Synapse using BCP?
Comments Off on How to Load Local File to Azure Synapse using BCP?

Azure Synapse INSERT with VALUES Limitations and Alternative

Azure Synapse Analytics data warehouse is based on TSQL. But, not all TSQL features are available in Azure Synapse dedicated SQL pool. The feature such as using an expression or UDF in VALUES clause of INSERT INTO table statement is not supported. In this article, we will check Azure Synapse INSERT with VALUES limitations and alternative methods. Azure Synapse INSERT with VALUES Limitations The VALUES clause Introduces the list or lists of data values to be inserted. There must be one data value for each column in column_list, if specified, or…

Continue ReadingAzure Synapse INSERT with VALUES Limitations and Alternative
Comments Off on Azure Synapse INSERT with VALUES Limitations and Alternative

Azure Synapse Analytics Cursor Alternative

SQL Cursor is a database object to retrieve data from a result set one row at a time. Database such as Oracle, Teradata, Microsoft SQL Server support cursors. The cursor are useful in many scenarios such as retrieving records in a loop. SQL Cursor always returns one row at a time, you can perform your calculation on returned values. In this article, we will check what is Azure Synapse Analytics Cursor Alternative with an example. Does Azure Synapse Analytics support SQL Cursor Variable? The Microsoft SQL Server, which is based…

Continue ReadingAzure Synapse Analytics Cursor Alternative
Comments Off on Azure Synapse Analytics Cursor Alternative

Azure Synapse DROP TABLE IF EXISTS Alternatives

Many relational databases such as Netezza supports DROP TABLE IF EXISTS syntax to safely drop table if it is already present in the database. The Microsoft SQL Server 2016 or higher version supports drop table if exists. However, same command won't work on Azure Synapse dedicated SQL pool server. In this article, we will check what are the Azure Synapse analytics DROP TABLE IF EXISTS alternatives with some examples. Azure Synapse DROP TABLE IF EXISTS Alternatives The DROP TABLE IF EXISTS statement checks the existence of the table in the schema, and…

Continue ReadingAzure Synapse DROP TABLE IF EXISTS Alternatives
Comments Off on Azure Synapse DROP TABLE IF EXISTS Alternatives

Create External Tables in Azure Synapse Analytics

There are many situations in which you need to access the data without loading it to Azure Synapse analytics. The data may be stored in an external data source such as flat files. Azure Synapse Analytics dedicated SQL pool allows you to query external data available on Azure the data lake or Azure Blob storage. In this article, we will check how to create external tables in Azure Synapse Analytics. Create External Tables in Azure Synapse Analytics Create MASTER KEYCreating a Database Scoped CredentialCreating External Data SourceCreate an External File…

Continue ReadingCreate External Tables in Azure Synapse Analytics
Comments Off on Create External Tables in Azure Synapse Analytics

SQL GROUP BY with CUBE Function Alternative in Synapse

Many relational databases such as Oracle, Teradata, etc. support GROUP BY with CUBE function to group the result rows. However, Azure Synapse does not support GROUP BY with CUBE function. In this article, we will check the SQL GROUP BY CUBE function alternative in the Azure Synapse data warehouse. SQL GROUP BY with CUBE Function Alternative in Synapse Similar to the ROLLUP function, CUBE is an extension of the GROUP BY clause. The CUBE allows you to generate subtotals like the ROLLUP extension. In addition, the CUBE extension will generate subtotals for all combinations of grouping columns specified in the GROUP BY clause.…

Continue ReadingSQL GROUP BY with CUBE Function Alternative in Synapse
Comments Off on SQL GROUP BY with CUBE Function Alternative in Synapse

QUALIFY Clause in Synapse and TSQL- Alternative and Examples

The Azure Synapse data warehouse is based on the Microsoft TSQL. If you are migrating from Teradata to Azure Synapse, you will notice that many features are missing in the Synapse date warehouse. The feature such as QUALIFY clause is widely used in Teradata. But, the same feature is not available in Synapse. In this article, we will check what is QUALIFY Clause alternative in Azure Synapse and TSQL. QUALIFY Clause in Azure Synapse and TSQL The relational databases such as Teradata uses QUALIFY clause to filter the result of…

Continue ReadingQUALIFY Clause in Synapse and TSQL- Alternative and Examples
Comments Off on QUALIFY Clause in Synapse and TSQL- Alternative and Examples

SQL INITCAP Function Alternative in Azure Synapse and TSQL

The INITCAP function is one of the quite useful functions you can use to capitalize the first letter (CamelCase) of each word. The popular relational databases such as Oracle, Teradata, etc. support INITCAP function to represent strings in a CamelCase. But, same function will not work on the Microsoft SQL Server or Azure Synapse analytics data warehouse. Both SQL Server and Azure Synapse databases are based on TSQL. In this article, we will check what are the INITCAP function alternative in Azure Synapse and TSQL. INITCAP Function Alternative in Azure…

Continue ReadingSQL INITCAP Function Alternative in Azure Synapse and TSQL
Comments Off on SQL INITCAP Function Alternative in Azure Synapse and TSQL

SQL LPAD and RPAD Functions Alternative in Synapse and TSQL

Many relational databases such as Oracle, Teradata supports LPAD and RPAD functions. These functions are quite useful when you are formatting data before storing it in a database or displaying data on reports. For example, add zero to integer column. But, Azure Synapse data warehouse which is based on the Microsoft SQL Server TSQL does not support LPAD and RPAD functions. You have to use TSQL built-in functions or create your own user defined functions (UDF). In this article, we will check what are the LPAD and RPAD Functions Alternative…

Continue ReadingSQL LPAD and RPAD Functions Alternative in Synapse and TSQL
Comments Off on SQL LPAD and RPAD Functions Alternative in Synapse and TSQL