<?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: Query in tmssqlInput to retrieve data on date conditon in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300670#M72876</link>
    <description>If you want to use Java instead of sql then use :&amp;nbsp;
&lt;BR /&gt;TalendDate.addDate(TalendDate.getCurrentDate(),-30,"dd")
&lt;BR /&gt;or
&lt;BR /&gt;TalendDate.addDate(TalendDate.getCurrentDate(),-1,"MM") -&amp;gt; -1 month
&lt;BR /&gt;it will returns a date that you MUST convert into a string, see formatDate function&amp;nbsp;
&lt;BR /&gt;then insert the string into your query</description>
    <pubDate>Tue, 14 Jul 2015 12:37:47 GMT</pubDate>
    <dc:creator>Jcs19</dc:creator>
    <dc:date>2015-07-14T12:37:47Z</dc:date>
    <item>
      <title>Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300666#M72872</link>
      <description>Hi,
&lt;BR /&gt;I have requirement where i have to query data on the table based on the date condition and write it into a csv file.
&lt;BR /&gt;I have used the where conditon in query like :
&lt;BR /&gt;"where modification_time&amp;lt;'Talend.getCurrentDate()-30'"
&lt;BR /&gt;but this is giving me an error&amp;nbsp;
&lt;BR /&gt;
&lt;B&gt;"Conversion failed when converting the varchar value 'TalendDate.getCurrentDate()' to data type int."&lt;/B&gt;
&lt;BR /&gt;
&lt;BR /&gt;please help as this is urgent.
&lt;BR /&gt;Thanks,
&lt;BR /&gt;Tulasi</description>
      <pubDate>Sat, 16 Nov 2024 11:08:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300666#M72872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300667#M72873</link>
      <description>&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;"where modification_time&amp;lt;'Talend.getCurrentDate()-30'" has a bad synthax&lt;/FONT&gt;&lt;/FONT&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;I tihnk its "where modification_time &amp;lt; ' " + Talend.getCurrentDate() - 30 + " ' " (see the single quote)&lt;/FONT&gt;&lt;/FONT&gt;
&lt;BR /&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Also Im not sure if you can do&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Talend.getCurrentDate() - 30&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Tue, 14 Jul 2015 08:08:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300667#M72873</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-07-14T08:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300668#M72874</link>
      <description>HI, 
&lt;BR /&gt;i have tried the below condition it is not working. 
&lt;BR /&gt;I have requirement where i have to retrieve all the data from database based on date condition to get the no of days between today's date and the modified date. 
&lt;BR /&gt;Can you please help me with the comparision. 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Tulasi</description>
      <pubDate>Tue, 14 Jul 2015 11:51:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300668#M72874</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T11:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300669#M72875</link>
      <description>Are you wanting to return data based on the number of days from the current date? If so, there is absolutely no need make it complicated by using Java to build your SQL query. The example below is a VERY basic example that you should be able to extrapolate from. This returns the number of days between the SYSDATE (current date) and the date specified.&amp;nbsp;
&lt;BR /&gt;
&lt;PRE&gt;select datediff(SYSDATE(), '2010-04-12');&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jul 2015 12:18:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300669#M72875</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T12:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300670#M72876</link>
      <description>If you want to use Java instead of sql then use :&amp;nbsp;
&lt;BR /&gt;TalendDate.addDate(TalendDate.getCurrentDate(),-30,"dd")
&lt;BR /&gt;or
&lt;BR /&gt;TalendDate.addDate(TalendDate.getCurrentDate(),-1,"MM") -&amp;gt; -1 month
&lt;BR /&gt;it will returns a date that you MUST convert into a string, see formatDate function&amp;nbsp;
&lt;BR /&gt;then insert the string into your query</description>
      <pubDate>Tue, 14 Jul 2015 12:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300670#M72876</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-07-14T12:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300671#M72877</link>
      <description>Hi,&lt;BR /&gt;I have tried to check the difference between the two dates if it is &amp;gt;90 days.&lt;BR /&gt;but i am not able to compare them using the &amp;gt; or &amp;lt; operators.&lt;BR /&gt;Is there any alternative for this.&lt;BR /&gt;Thanks,&lt;BR /&gt;Tulasi</description>
      <pubDate>Tue, 14 Jul 2015 13:14:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300671#M72877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T13:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300672#M72878</link>
      <description>Are you trying to do this in Java or in SQL? That is an important question which you must answer for help. The SQL that is used in the tMSSQLInput (I've just realised you are using MS SQL and not MySQL which my previous answer was aimed at) is basically a Java String. You *can* make this dynamic and change hardcoded values based on the data you are working with in Java. This will produce SQL code engineered specifically for that particular datarow. That is what jcs19 is talking about. This is a really effective method of working IF (and only IF) you can write SQL and Java well enough to be able to write one code with the other. I sense from your question that you are not an experienced SQL developer and/or not an experienced Java developer. 
&lt;BR /&gt;We can get round this, but you must give us all of the information. It might be that it is easier for you to write this entirely in SQL or it could be that Java &amp;nbsp;is required. The first thing to do is to figure out the base SQL that will be needed and then we can help you to parameterise it to make it dynamic (if you need to do that).&amp;nbsp; 
&lt;BR /&gt;So what is it exactly that you are trying to do?&amp;nbsp;</description>
      <pubDate>Tue, 14 Jul 2015 13:41:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300672#M72878</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T13:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300673#M72879</link>
      <description>hi,&lt;BR /&gt;(TalendDate.diffDate(myDate,myDate2,"dd")&amp;gt;90)?"Date is superior":"Date is inferior"&lt;BR /&gt;What are you trying to do ? changing your query ? or filtering</description>
      <pubDate>Tue, 14 Jul 2015 13:56:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300673#M72879</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-07-14T13:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300674#M72880</link>
      <description>HI,
&lt;BR /&gt;We are actually trying to archive the data from database of past 120 days from today and write it into a csv file.
&lt;BR /&gt;I am querying on a table using the tmssqlInput---&amp;gt;tmap---&amp;gt;tfileoutputdelimited.
&lt;BR /&gt;In tmssqlInput i am writing a select query based on the condition:
&lt;BR /&gt;select * from table where modified_date &amp;lt; today's date-120
&lt;BR /&gt;where modified_date is column in the table and today's date is currentdate.
&lt;BR /&gt;Now i am not able to use the '&amp;lt;' condition properly.</description>
      <pubDate>Tue, 14 Jul 2015 14:24:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300674#M72880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T14:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300675#M72881</link>
      <description>Try something like this....
&lt;BR /&gt;
&lt;BR /&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;select *&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;from table &lt;BR /&gt;where DATEDIFF(DD,modified_date,&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT face="consolas, monaco, 'bitstream vera sans mono', 'courier new', courier, monospace"&gt;getdate())&amp;lt;=120 AND&amp;nbsp;&lt;/FONT&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;DATEDIFF(DD,modified_date,&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT face="consolas, monaco, 'bitstream vera sans mono', 'courier new', courier, monospace"&gt;getdate())&amp;gt;=0&lt;/FONT&gt;</description>
      <pubDate>Tue, 14 Jul 2015 14:59:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300675#M72881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-14T14:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Query in tmssqlInput to retrieve data on date conditon</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300676#M72882</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;HI,&lt;BR /&gt;We are actually trying to archive the data from database of past 120 days from today and write it into a csv file.&lt;BR /&gt;I am querying on a table using the tmssqlInput---&amp;gt;tmap---&amp;gt;tfileoutputdelimited.&lt;BR /&gt;In tmssqlInput i am writing a select query based on the condition:&lt;BR /&gt;select * from table where modified_date &amp;lt; today's date-120&lt;BR /&gt;where modified_date is column in the table and today's date is currentdate.&lt;BR /&gt;Now i am not able to use the '&amp;lt;' condition properly.&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;&amp;lt; and &amp;gt; should work on your sql query
&lt;BR /&gt;I'm pretty sure that you made a mistake on&amp;nbsp;today's date-120
&lt;BR /&gt;At the end, your SQL Query should be like "select * from table where modified_date &amp;lt; '2015-05-02';"
&lt;BR /&gt;
&lt;BR /&gt;I wanted you to find the solution alone, it's so much more exciting
&lt;BR /&gt;
&lt;BR /&gt;Two solutions&amp;nbsp;
&lt;BR /&gt;SQL: "Select * from table WHERE&amp;nbsp;modified_date&amp;nbsp;&amp;gt; DATEADD(
&lt;FONT color="#2a2a2a"&gt;&lt;FONT face="Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif"&gt;&lt;B&gt;dd&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;, -120, getdate()) ;"
&lt;BR /&gt;
&lt;BR /&gt;Java: "Select * from table where modified_date &amp;lt; ' " +&amp;nbsp;
&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;FONT size="1"&gt;TalendDate.formatDate("yyyy-MM-dd",TalendDate.addDate(TalendDate.getCurrentDate(),-120,"dd"))&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;+ " ' ;"</description>
      <pubDate>Tue, 14 Jul 2015 14:59:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Query-in-tmssqlInput-to-retrieve-data-on-date-conditon/m-p/2300676#M72882</guid>
      <dc:creator>Jcs19</dc:creator>
      <dc:date>2015-07-14T14:59:06Z</dc:date>
    </item>
  </channel>
</rss>

