Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to run Long SQL with bat command via iterative macro?

Crazycc
6 - Meteoroid

I currently use <run command> to run <run.bat> , just like this: 

@echo off
sqlcmd -S localhost -d xx -U sa -P xxxx -i "D:\test0515\test02.sql" -o "D:\test0515\test.txt"

<test02.sql> is a long mssql  sql file(select * into test), that always runs over 3mins. To avoid the situation where SQL has not finished executing before Alteryx continues with the subsequent processes. 

I decide to use iterative macro:

1, put  iterative macro between <run.bat> and other module(Dynamic Input to read table that generate from SQL)

2, read test.txt every 30 seconds, find <xx rows affected>

3, if not find it then continue in iterative macro, it do exit the macro

I currently have no idea with specific solutions above, plz help.

4 REPLIES 4
Krzysiek
8 - Asteroid

Hey, 

I am not sure if I got your issue correctly, but if it is about executing workflow just after SQL completes, you may want to try using "Block Until Done Tool".

This way your workflow will be stopped and executed only after swim lane with your SQL query will be fully executed.

 

Please see below:

Capture.PNG

apathetichell
18 - Pollux

1) your cmd syntax seems fine.

2) 3 minutes is nothing in terms of SQL queries...

3) I'd use a standard workflow design.

Crazycc
6 - Meteoroid

It works, really appreciate!

Crazycc
6 - Meteoroid

1) your cmd syntax seems fine.

2) 3 minutes is nothing in terms of SQL queries...

3) I'd use a standard workflow design.

 

This is just a demo. In actual scenarios, the SQL processes need to run for more than 5 hours to handle over 3.5 billion rows of data.

Labels