<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SQL Syntax error in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206446#M387714</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be something wrong in that steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;[$(vPrefix)]:&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit;"&gt;LOAD&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Concat(Chr(39)&amp;amp;DG_CODE&amp;amp;Chr(39),',') as list&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;From [$(vDataTier1)\$(vPrefix)_$(vPeriod).qvd] (qvd);&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;LET vData = '(' &amp;amp;FieldValue('list',1) &amp;amp; ')';&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;tmp:&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;NoConcatenate&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;SQL SELECT DG_CODE, dg_nmen-(cast(oneway as decimal)/2) as pax&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;FROM DOGOVOR&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;OUTER APPLY(select count(*) oneway from (&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt; SELECT tu_key, count(*) as cnt from turist join turistservice on tu_key=tu_tukey join dogovorlist on dl_key = tu_dlkey and dl_svkey=1 where tu_dgcod=dg_code group by tu_key &lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) tu where cnt=1 and not exists(select 1 from Dogovorlist dlt where dlt.dl_dgcod=dg_code and dl_svkey in (3,2,4))&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;) ow &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;STRONG&gt;WHERE DG_CODE in '$(vData)'; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Oct 2016 18:45:32 GMT</pubDate>
    <dc:creator>lylererger</dc:creator>
    <dc:date>2016-10-19T18:45:32Z</dc:date>
    <item>
      <title>SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206442#M387710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Community!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why...why QlikView by transmission of a variable into the SQL-query replaces single quotes with double?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="syntax error.png" class="jive-image image-1" src="/legacyfs/online/141241_syntax error.png" style="height: 338px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a result writes that a syntax error. how to eliminate this error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 17:04:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206442#M387710</guid>
      <dc:creator>lylererger</dc:creator>
      <dc:date>2016-10-19T17:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206443#M387711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usually it doesn't do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SQL Syntax Error thread237001.jpg" class="jive-image image-1" src="/legacyfs/online/141248_SQL Syntax Error thread237001.jpg" style="height: 181px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something else may be wrong in your code. Can you post your script, or at least a big chunk of it that contains the erroneous code? Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 17:15:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206443#M387711</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-10-19T17:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206444#M387712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The outer quotes shouldn't be there at all I think. Usually it's &lt;EM&gt;WHERE Foo IN ('A','B','C')&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 17:35:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206444#M387712</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-10-19T17:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206445#M387713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I too think so, but still can't identify problem %(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14769023760956555 jive_text_macro" jivemacro_uid="_14769023760956555"&gt;
&lt;P&gt;LET vTaskCode = 'E315';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IF vScript LIKE '*+$(vTaskCode)*' THEN&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRACE [-----$(vTaskCode)-----];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; //-----------Каталоги проекта&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CALL ProjectFolders(1)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; //-----------Строка подключения&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CALL Connection(1);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; //-----------Периодичность загрузки&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CALL Reload(vReload);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; //-----------Источники и приемник данных&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vPrefix = 'DOGOVOR';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vTable = 'PAX';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vDateStart = Num(vDateStart);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vDateFinish = Num(vDateFinish);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; //----------Цикл от большего к меньшему&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vStartYear = Year(vDateStart);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vStartMonth = Month(vDateStart);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastYear = Year(vDateFinish);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastMonth = Month(vDateFinish);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadYear = vLastYear;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadMonth = vLastMonth;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DO WHILE vLoadYear &amp;gt;= vStartYear&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DO WHILE (vLoadMonth &amp;gt;= 1 AND vLoadYear &amp;gt; vStartYear) OR (vLoadMonth &amp;gt;= vStartMonth AND vLoadYear = vStartYear)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadMonthStr = NUM(vLoadMonth, '00');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vPeriod = $(vLoadYear)$(vLoadMonthStr);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRACE;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRACE [-----ОБРАБОТКА ПЕРИОДА $(vPeriod)-----];&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRACE;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; IF QvdNoOfRecords('$(vDataTier1)\$(vPrefix)_$(vPeriod).qvd')&amp;gt;0 then&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [$(vPrefix)]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LOAD&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;Concat(Chr(39)&amp;amp;DG_CODE&amp;amp;Chr(39),',') as list&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; From [$(vDataTier1)\$(vPrefix)_$(vPeriod).qvd] (qvd);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; LET vData = '(' &amp;amp;FieldValue('list',1) &amp;amp; ')';&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; LET vRows = NoOfRows('$(vPrefix)');&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; tmpData: LOAD * Inline [tmpField];&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; FOR vIx=0 to vRows-1&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; LET vI = vIx + 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; TRACE [----ОБРАБОТКА СТРОКИ $(vI) ИЗ $(vRows)-----];&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; LET vDG_CODE = Peek('DG_CODE',vIx,'$(vPrefix)');&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; tmp:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; NoConcatenate&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; SQL SELECT DG_CODE, dg_nmen-(cast(oneway as decimal)/2) as pax&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; FROM DOGOVOR&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTER APPLY(select count(*) oneway from (&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT tu_key, count(*) as cnt from turist join turistservice on tu_key=tu_tukey join dogovorlist on dl_key = tu_dlkey and dl_svkey=1 where tu_dgcod=dg_code group by tu_key&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) tu where cnt=1 and not exists(select 1 from Dogovorlist dlt where dlt.dl_dgcod=dg_code and dl_svkey in (3,2,4))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ow&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'arial black', 'avant garde';"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;&amp;nbsp; WHERE DG_CODE in '$(vData)';&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; EXIT Script&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; IF NoOfRows('tmp')&amp;gt;0 THEN&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Concatenate (tmpData)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; *&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Resident tmp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ENDIF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CALL DropTables('tmp');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; NEXT vIx&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DROP Field tmpField from tmpData;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; IF NoOfRows('tmpData')&amp;gt;0 THEN&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vtmpFile = '$(vDataTier2)\$(vTable)_$(vPeriod).qvd';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; EXECUTE cmd.exe /C del /Q $(vtmpFile);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; STORE tmpData INTO&amp;nbsp; [$(vtmpFile)] (qvd);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ENDIF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CALL DropTables('tmpData|$(vPrefix)');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ELSE&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRACE [-----НЕТ ДАННЫХ ЗА ПЕРИОД $(vPeriod)-----];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ENDIF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadMonth = vLoadMonth - 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LOOP&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadMonth = 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLoadYear = vLoadYear-1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LOOP&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DISCONNECT;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IF vScript LIKE '*$(vTaskCode)-*' THEN&lt;/P&gt;
&lt;P&gt;&amp;nbsp; EXIT Script;&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;




&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 18:41:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206445#M387713</guid>
      <dc:creator>lylererger</dc:creator>
      <dc:date>2016-10-19T18:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206446#M387714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be something wrong in that steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;[$(vPrefix)]:&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit;"&gt;LOAD&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Concat(Chr(39)&amp;amp;DG_CODE&amp;amp;Chr(39),',') as list&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;From [$(vDataTier1)\$(vPrefix)_$(vPeriod).qvd] (qvd);&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: black; font-style: inherit; font-size: 9pt;"&gt;2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;LET vData = '(' &amp;amp;FieldValue('list',1) &amp;amp; ')';&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; line-height: 1.5em; color: #000000; font-size: 12px; font-style: inherit; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;tmp:&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;NoConcatenate&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;SQL SELECT DG_CODE, dg_nmen-(cast(oneway as decimal)/2) as pax&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;FROM DOGOVOR&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;OUTER APPLY(select count(*) oneway from (&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt; SELECT tu_key, count(*) as cnt from turist join turistservice on tu_key=tu_tukey join dogovorlist on dl_key = tu_dlkey and dl_svkey=1 where tu_dgcod=dg_code group by tu_key &lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) tu where cnt=1 and not exists(select 1 from Dogovorlist dlt where dlt.dl_dgcod=dg_code and dl_svkey in (3,2,4))&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;) ow &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;STRONG&gt;WHERE DG_CODE in '$(vData)'; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 18:45:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206446#M387714</guid>
      <dc:creator>lylererger</dc:creator>
      <dc:date>2016-10-19T18:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206447#M387715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;Omg. there is no need to write the single quotes before and after declaration of variable in sql syntax.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;H6 style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" class="font-color-meta-light" href="https://community.qlik.com/message/1145538#1145538" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #a9a9a9;"&gt;Re: SQL Syntax error&lt;/A&gt;&lt;/STRONG&gt;&lt;/H6&gt;&lt;P class="j-post-avatar" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A _jive_internal="true" class="j-avatar jiveTT-hover-user" data-avatarid="6257" data-externalid="" data-presence="null" data-userid="96544" data-username="gwassenaar" href="https://community.qlik.com/people/gwassenaar" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #3778c7;"&gt;&lt;IMG alt="gysbert wassenaar" border="0" class="jive-avatar jive-image" data-avatarid="6257" data-height="46" data-username="gwassenaar" height="46" src="https://community.qlik.com/people/gwassenaar/avatar/46.png?a=6257" style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;" width="46" /&gt;&lt;SPAN class="j-status-levels j-gamification-status-level" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Legend" class="jive-image" src="https://qvfiles.s3.amazonaws.com/community/L11.png" style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;" title="Legend" /&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author" style="font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 11.7px; font-family: inherit;"&gt;&lt;A href="https://community.qlik.com/people/gwassenaar"&gt;gwassenaar&lt;/A&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H1&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/H1&gt;&lt;P&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;thanks a lot )))&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;H1&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/H1&gt;&lt;H1&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;WHERE DG_CODE in $(vData);&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/H1&gt;&lt;P&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: verdana, geneva;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 18:48:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206447#M387715</guid>
      <dc:creator>lylererger</dc:creator>
      <dc:date>2016-10-19T18:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Syntax error</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206448#M387716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good catch. If I change my own example into this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SQL Syntax Error 2 thread237001.jpg" class="jive-image image-1" src="/legacyfs/online/141279_SQL Syntax Error 2 thread237001.jpg" style="height: 169px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the same single-quote-into-double-quote substitution. Should remember that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the points, but consider changing the Correct assignment to Gysberts post as he pointed out the real cause of your problem. You can still change it. Moreover, it looks better when the original question and the correct answer are combined in the same frame at the top of this thread.&lt;/P&gt;&lt;P&gt;If you think other posts provded useful feedback, you can still assign &lt;EM&gt;Helpfuls&lt;/EM&gt; by selecting the corresponding item from the Actions menu. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 20:46:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Syntax-error/m-p/1206448#M387716</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-10-19T20:46:18Z</dc:date>
    </item>
  </channel>
</rss>

