<?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 'Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name' at given SQL variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513696#M36585</link>
    <description>&lt;P&gt;I have an SQL script that has to run in QlikSense to fetch the needed data for my application. First I defined some SQL variables to use in the script. When I run the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SET vgl = 'MATE1';
LET vglId = 1;
LET startTS = 'null';
LET endTS = 'null';

LIB CONNECT TO 'db02';

SQL

select a.id, a.patientNummer, a.achternaam, a.tussenvoegsel, a.voorletters, a.geboortedatum, a.geslacht, a.email, a.opmerkingx,
       a.geblokkeerd, a.startDatum, a.bsn, a.meettrajectId, a.afgebroken, a.typeTraject, a.trajectStatus, a.taal, a.moment, a.startDatumMoment, a.ingestuurd,
       cast(a.score as numeric(5,2)) as score, a.eenheid, a.opmerking, a.schaalid, a.schaalnaam, a.volgnrInSchaalInt, a.volgnrInLijst, a.vglnaam, a.momentNr
       from
(
select *, null as opmerkingx
       from rom.vwOutputForAnalyseRom
where vglnaam = $(vgl) and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')) as a;&lt;/PRE&gt;&lt;P&gt;I receive the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;De volgende fout is opgetreden:

Connector reply error: ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name 'MATE1'.&lt;/PRE&gt;&lt;P&gt;When I change the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;where vglnaam = $(vgl) and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;where vglnaam = 'MATE1' and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')&lt;/PRE&gt;&lt;P&gt;I don't get an error anymore but by this way I don't use the variable $(vgl). How do I use the variable properly in this script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Dec 2021 20:32:06 GMT</pubDate>
    <dc:creator>qlikmark1990</dc:creator>
    <dc:date>2021-12-22T20:32:06Z</dc:date>
    <item>
      <title>'Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name' at given SQL variable</title>
      <link>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513696#M36585</link>
      <description>&lt;P&gt;I have an SQL script that has to run in QlikSense to fetch the needed data for my application. First I defined some SQL variables to use in the script. When I run the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SET vgl = 'MATE1';
LET vglId = 1;
LET startTS = 'null';
LET endTS = 'null';

LIB CONNECT TO 'db02';

SQL

select a.id, a.patientNummer, a.achternaam, a.tussenvoegsel, a.voorletters, a.geboortedatum, a.geslacht, a.email, a.opmerkingx,
       a.geblokkeerd, a.startDatum, a.bsn, a.meettrajectId, a.afgebroken, a.typeTraject, a.trajectStatus, a.taal, a.moment, a.startDatumMoment, a.ingestuurd,
       cast(a.score as numeric(5,2)) as score, a.eenheid, a.opmerking, a.schaalid, a.schaalnaam, a.volgnrInSchaalInt, a.volgnrInLijst, a.vglnaam, a.momentNr
       from
(
select *, null as opmerkingx
       from rom.vwOutputForAnalyseRom
where vglnaam = $(vgl) and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')) as a;&lt;/PRE&gt;&lt;P&gt;I receive the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;De volgende fout is opgetreden:

Connector reply error: ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name 'MATE1'.&lt;/PRE&gt;&lt;P&gt;When I change the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;where vglnaam = $(vgl) and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;where vglnaam = 'MATE1' and startDatumMoment between isnull($(startTS), '2000-01-01') and isnull($(endTS), '2040-01-01')&lt;/PRE&gt;&lt;P&gt;I don't get an error anymore but by this way I don't use the variable $(vgl). How do I use the variable properly in this script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 20:32:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513696#M36585</guid>
      <dc:creator>qlikmark1990</dc:creator>
      <dc:date>2021-12-22T20:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: 'Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name' at given SQL variable</title>
      <link>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513989#M36636</link>
      <description>Whenever, We are working with SQL and Qlik. They will work there own way not altogether. So, You can't use SET and LET variables into SQL queries. Instead using Resident load will deserve.</description>
      <pubDate>Thu, 29 Nov 2018 05:12:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513989#M36636</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-11-29T05:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: 'Microsoft OLE DB Provider for SQL Server, ErrorMsg: Invalid column name' at given SQL variable</title>
      <link>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513995#M36637</link>
      <description>&lt;P&gt;You need to include the quotes:&lt;/P&gt;&lt;PRE&gt;where &lt;STRONG&gt;vglnaam = '$(vgl)'&lt;/STRONG&gt; and startDatumMoment between isnull($(startTS), ....&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 05:57:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Microsoft-OLE-DB-Provider-for-SQL-Server-ErrorMsg-Invalid-column/m-p/1513995#M36637</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2018-11-29T05:57:20Z</dc:date>
    </item>
  </channel>
</rss>

