Question
Vivek Nayak · Sep 6, 2019

How to execute multiple query or script in sql management studio?

I want to insert multiple records in the table using below queries, but it gives an error.

 

00
0 3 593 0

Replies

Insert into LISDB.State (short,long)
SELECT 'AL','Alabama'
Union All
SELECT 'AK','Alaska'
Union All
SELECT 'AZ','Arizona'
Union All
SELECT 'AR','Arkansas'

Suppose you have your sql script in script.sql

You can call the following command:

do $System.SQL.DDLImport("IRIS",$Username,"/path/script.sql")

It will execute all the lines one-by-one.

Learn more in documentation.

There is no pretty way to do it via management portal.

Either use a JDBC tool like squirrel or sql workbench, or use an sql file with do $System.SQL.DDLImport