<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C# SQL Date Query</title><link>https://www.aras.com/community/f/development/38069/c-sql-date-query</link><description>Good day all, 
 I am trying to create a dynamic report to produce the time it take between starting an activity and ending an activity. I can get the information I am looking for by using SQL, but it will not limit the returns based on dates. I have tried</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9637?ContentTypeID=1</link><pubDate>Thu, 24 Aug 2023 21:44:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:24a78575-819f-4379-a5dd-af41e26fa16b</guid><dc:creator>Nathan H.</dc:creator><description>&lt;p&gt;Thank you.&amp;nbsp; I removed the dashes and it worked.&amp;nbsp; Now to set it up for a selectable date range.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9636?ContentTypeID=1</link><pubDate>Thu, 24 Aug 2023 15:45:01 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4554fd9a-8685-44c3-b219-319a107602f0</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Edit: We are all blind!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Take a look at my picture again. Do you notice something? I have added your BETWEEN date filter.&amp;nbsp;Does the filter work? Yes...but NO! It&amp;acute;s uses the filter but with the date in a in wrong format, which can lead to all kind of wrong results. [I cannot remember ever having similar problems before whenever using dates....]&lt;/p&gt;
&lt;p&gt;Solution in my case:&amp;nbsp;WHERE&amp;nbsp; (Act_Assign.MODIFIED_ON BETWEEN &amp;#39;20230801&amp;#39; AND &amp;#39;20230802&amp;#39;)&lt;/p&gt;
&lt;p&gt;As alternative, something with convert(datetime,...) should also do the job.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9635?ContentTypeID=1</link><pubDate>Thu, 24 Aug 2023 15:30:25 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:fd673ca2-f7c5-4caf-a91b-c3f7c8159da9</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;So you don&amp;acute;t get access to the server, but people are completely fine with you executing direct SQL in Innovator?&amp;nbsp;&amp;nbsp;&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Technically there isn&amp;acute;t anything obviously wrong with the query. Maybe it&amp;acute;s a logical issue. E.g. wrong date for searching or wrong join.&lt;/p&gt;
&lt;p&gt;Why do you search for a BETWEEN of the modified_on?&amp;nbsp;Look at my image. Modified_on is maybe not&amp;nbsp;the&amp;nbsp;property of interest. As you have in your SELECT part, created_on and closed_on specify the date range of the activity.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9634?ContentTypeID=1</link><pubDate>Wed, 23 Aug 2023 17:18:48 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6b8d3e3c-d3c0-470c-b684-cf097c3fcb8f</guid><dc:creator>Nathan H.</dc:creator><description>&lt;p&gt;I don&amp;#39;t have access to our SQL server.&amp;nbsp; The SQL code is in a C# method.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9633?ContentTypeID=1</link><pubDate>Wed, 23 Aug 2023 16:48:35 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c9aaf99f-cbb0-4397-82f0-a9cee0b1cbfe</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;SSMS ist just the MS SQL Server Management Studio. I assumed you used it to build the query.&lt;/p&gt;
&lt;p&gt;Out of interest I made a quick test of the query. I had to remove one table that I don&amp;acute;t have, but the rest worked (in SSMS).&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1692809097672v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Is your ORDER BY&amp;nbsp;part also ignored?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9632?ContentTypeID=1</link><pubDate>Wed, 23 Aug 2023 16:32:21 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:2b2f8420-c1ed-4322-ba06-a6a14a4a49cf</guid><dc:creator>Nathan H.</dc:creator><description>&lt;p&gt;Angela,&lt;/p&gt;
&lt;p&gt;I do get results.&amp;nbsp; The results indicate that the Act_Assign.modified_on BETWEEN &amp;#39;2023-08-01&amp;#39; AND &amp;#39;2023-08-02&amp;#39; is being ignored and everything is returned.&amp;nbsp; If I try to put the date in a format of mm/dd/yy the system will give an error of incorrect date format.&amp;nbsp; I agree that the mm/dd/yy format is stupid.&amp;nbsp; The filters for the name are to limit the returns during testing.&amp;nbsp; The end product will not have those filters.&amp;nbsp; What is SSMS?&amp;nbsp; Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C# SQL Date Query</title><link>https://www.aras.com/community/thread/9631?ContentTypeID=1</link><pubDate>Wed, 23 Aug 2023 16:17:18 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:87d21f61-c7d3-4e17-b092-e134ea154a41</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;&lt;span&gt;Does the query deliver correct result in SSMS?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you get too much results, or no results at all?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you get no results, your date format is probably not recognized&amp;nbsp;by&amp;nbsp;&lt;/span&gt;Innovator and you need to convert it:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://www.aras.com/community/f/development/38025/innovator-sql-procedures-vs-date-format---how-to-prevent-conversion-to-american-date-format"&gt;Innovator SQL Procedures vs. Date Format - how to prevent conversion to American date format?&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you get too much results, check your WHERE query. You have two filters for name. But the second maybe&amp;nbsp;connects to the AND for the date, so you maybe need more brackets.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>