1. Add a Rung for each required SQL query.
1. 1 Create a string tag (Data type = DBGW_strWrite) for SQL query.
1.2 Copy tested SQL query from Microsoft SQL Server Management Studio to this string tag.
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-41.png?media=1717662251)
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-42.png?media=1717662251)
Note: $r$l$t (Same as CRLFTAB = Carriage return – Line feed – Tab) or $r$l (Same as CRLF = Carriage return – Line feed) don’t have to be removed. SQL query will work anyway.
1.3 The tags “Trig_Select” and “Trig_Update” has to be set by your logic!
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-34-1024x395.png?media=1717662251)
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-35-1024x609.png?media=1717662251)
2. Start execution of SQL query by changing DBGW1.Trigger.
Note: Execution finished when: DBGW1.Trigger=DBGW1.TriggerDone.
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-36-1024x442.png?media=1717662251)
3. Execution successfully. Resetting triggering tags and DBGW_QueryNo
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-37-1024x322.png?media=1717662251)
4. Execution faulted. After 3 retries DBGW_QueryNo will be reset, and hereby opens up for new SQL queries
![](https://usercontent.one/wp/www.systemintegration.dk/wp-content/uploads/2020/12/image-38-1024x555.png?media=1717662251)
5. Open DBGW_Demo.ACD for copying or for inspiration.