How to Process SQL Batches for Azure Synapse Analyics with sqlcmd

Datometry solutions such as Hyper-Q and qShift may require the execution of SQL batch files against Azure Synapse Analytics ("Synapse") by the administrator. A commonly used and often readily available client application to execute these batch files is the command line tool sqlcmd, which is part of the Microsoft Tools for SQL Server. To process batch files with multiple DDL statements successfully, such as installing and upgrading Hyper-Q standard UDFs or applying qShift-generated output, sqlcmd requires a dedicated separator between statements. There are two options to achieve this:

  1. insert the word GO on a separate line between every two statements in the batch file
  2. leverage a different word as separator, which already exists in the batch file and is placed on a separate line between statements

Option 1 can easily be used with qShift output by requesting from your Datometry representative that the qShift output be suffixed with GO when generated for you.

Option 2 can be used out of the box with installing or upgrading Hyper-Q standard UDFs; the source files are formatted with a ; (semicolon) on a separate line between statements. Using the command line argument -c ';' with sqlcmd will instruct it to treat the semicolon as batch separator.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.