<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: black; font-family: Tahoma, sans-serif;">Hello,</span><br>
</div>
<div>
<div style="font-family:Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">In QGIS 2.18.23, I´m using the model "Execute SQL" from the Tollbox to run the statment:</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">"SELECT * FROM input1 ORDER BY TALHAO ASC;"</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">​where "TALHAO" is the name of a colum with integer values.</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">My issue is:</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">I made a Model with several steps, and I need to put this SQL statment in the middle of it,</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">but this process never accept a output as input.</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">For example: if the "Execute SQL" is the first step, it will execute normally,</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">but if it is not the first one, I got this error:</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:red">Error executing algorithm Execute SQL
</span><span style="font-family:"Tahoma","sans-serif"; color:black"></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif; margin-top:9.0pt; margin-right:0cm; margin-bottom:9.0pt; margin-left:0cm">
<b><span style="font-family:"Tahoma","sans-serif"; color:red">virtual:</span></b><span style="font-family:"Tahoma","sans-serif"; color:red"> Cannot find layer OUTPUTALGQGISDISSOLVE1_shp20181015165259558</span><span style="font-family:"Tahoma","sans-serif"; color:black"></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">Searching in the %temp% folder, this output file do exist!</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">I made another attempt,</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">with the SQL as first step,</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">if the input shape is named starting with letter, it will run</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">if the input name´s starts with number, a got this error:</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:red">Error executing algorithm Execute SQL
</span><span style="font-family:"Tahoma","sans-serif"; color:black"></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif; margin-top:9.0pt; margin-right:0cm; margin-bottom:9.0pt; margin-left:0cm">
<b><span style="font-family:"Tahoma","sans-serif"; color:red">virtual:</span></b><span style="font-family:"Tahoma","sans-serif"; color:red"> Query execution error on DROP TABLE IF EXISTS "input1"; CREATE VIRTUAL TABLE "input1" USING QgsVLayer(81121_463_DE20181015165152041);:
 1 - unrecognized token: "81121_463_DE20181015165152041"</span><span style="font-family:"Tahoma","sans-serif"; color:black"></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">I can´t understand why sometimes this algoritm run, and sometimes not</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">I would appreciate some help</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black"> </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-family:"Times New Roman",serif">
<span style="font-family:"Tahoma","sans-serif"; color:black">Thanks for the Attention</span></p>
<br>
</div>
<div style="font-family:Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:Arial; color:rgb(0,0,0); font-size:12pt">______________________________________________</span><br>
</div>
<div id="signature">
<div id="divtagdefaultwrapper" dir="ltr">
<div><font face="Arial"><font style="background-color:rgb(255,255,255)"><span style="line-height:20px"><font face="Arial, Helvetica, sans-serif"><span style="font-size:12pt"><b></b></span></font>
<div style="color:rgb(0,0,0); font-family:Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px; font-weight:bold">
<font face="Arial"><font color="#0c0c0c" size="4"><b style="line-height:20px">Herbert Lincon R. A. dos Santos</b></font></font></div>
<div style="color:rgb(0,0,0); font-family:Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px; font-weight:bold">
<br>
</div>
</span></font></font></div>
<div style="color:rgb(0,0,0); font-family:Arial,Helvetica,sans-serif; font-size:12pt">
<font face="Arial"><font size="3"><font style="color:rgb(42,42,42); background-color:rgb(255,255,255)"></font><br>
</font></font></div>
</div>
</div>
</div>
</body>
</html>