<?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: TalendDate in MssqlInput in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267411#M46309</link>
    <description>&lt;P&gt;Thanks guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get it running using the below code;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;DECLARE &amp;nbsp;@DtNow DATETIME = &amp;nbsp;'"+TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate())+ "'&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;</description>
    <pubDate>Fri, 19 Oct 2018 06:47:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-19T06:47:33Z</dc:date>
    <item>
      <title>TalendDate in MssqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267408#M46306</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to pass a variable in a MSSqlInput component to retrieve the current UTC time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the talend function&amp;nbsp;TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However when i place this into the MSSQL component and attempt to declare it as a variable i am getting some error. I have tried many variations, but still can not get it to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tMSSqlInput&lt;/P&gt;
&lt;P&gt;Query:&lt;/P&gt;
&lt;P&gt;"&lt;BR /&gt;DECLARE @DtNow DATETIME = TalendDate.formatDateInUTC(\"yyyy-MM-dd HH:mm:ss\", TalendDate.getCurrentDate() )&lt;BR /&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I am getting the below error&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;[statistics] connected&lt;BR /&gt;Exception in component tMSSqlInput_2 (Load_StatusCredits_CC)&lt;BR /&gt;com.microsoft.sqlserver.jdbc.SQLServerException: Cannot find either column "TalendDate" or the user-defined function or aggregate "TalendDate.formatDateInUTC", or the name is ambiguous.&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:885)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:778)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(SQLServerStatement.java:677)&lt;BR /&gt;[FATAL]: wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC - tMSSqlInput_2 Cannot find either column "TalendDate" or the user-defined function or aggregate "TalendDate.formatDateInUTC", or the name is ambiguous.&lt;BR /&gt;com.microsoft.sqlserver.jdbc.SQLServerException: Cannot find either column "TalendDate" or the user-defined function or aggregate "TalendDate.formatDateInUTC", or the name is ambiguous.&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:885)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:778)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.tMSSqlInput_2Process(Load_StatusCredits_CC.java:916)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.runJobInTOS(Load_StatusCredits_CC.java:1614)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.main(Load_StatusCredits_CC.java:1248)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)&lt;BR /&gt;at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(SQLServerStatement.java:677)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.tMSSqlInput_2Process(Load_StatusCredits_CC.java:916)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.runJobInTOS(Load_StatusCredits_CC.java:1614)&lt;BR /&gt;at wombat.load_statuscredits_cc_0_1.Load_StatusCredits_CC.main(Load_StatusCredits_CC.java:1248)&lt;BR /&gt;[statistics] disconnected&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 01:32:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267408#M46306</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-18T01:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: TalendDate in MssqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267409#M46307</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Since you are using tMSSQLInput component, you will have to write a SQL query to extract the UTC time. Could you please try the below query?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;GETUTCDATE()&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/t-sql/functions/getutcdate-transact-sql?view=sql-server-2017" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.microsoft.com/en-us/sql/t-sql/functions/getutcdate-transact-sql?view=sql-server-2017&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You are currently trying to run the declare part in MSSQLInput component. If your intention is to run a stored proc, could you please try tMSSQLSP component?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Warm Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Nikhil Thampi&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 07:58:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267409#M46307</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-18T07:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: TalendDate in MssqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267410#M46308</link>
      <description>&lt;P&gt;Everything inside the quotes in your query is sent to the database as-is.&amp;nbsp; What you want is to drop in the current timestamp at runtime.&amp;nbsp; To do this, alter your query like this:&lt;/P&gt;&lt;PRE&gt;"
DECLARE @DtNow DATETIME = '" + TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate() ) + 
"'&lt;BR /&gt;&lt;BR /&gt;SELECT @DtNow;"&lt;/PRE&gt;&lt;P&gt;When the job runs, the current date will be added to the query string and passed to the database.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 14:42:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267410#M46308</guid>
      <dc:creator>cterenzi</dc:creator>
      <dc:date>2018-10-18T14:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: TalendDate in MssqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267411#M46309</link>
      <description>&lt;P&gt;Thanks guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get it running using the below code;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;DECLARE &amp;nbsp;@DtNow DATETIME = &amp;nbsp;'"+TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate())+ "'&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2018 06:47:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-in-MssqlInput/m-p/2267411#M46309</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-19T06:47:33Z</dc:date>
    </item>
  </channel>
</rss>

