<?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: Datamart SQL and SYSDATE in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3644969#M32472</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It seems that the SQL statement you provided is not working on the datamart SQL. One possible solution is to use the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;function to check for null values and then convert the date to a string so it doesn’t try to convert ‘’ to a date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is my table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;The following SQL might work for you:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SELECT 
    CASE 
        WHEN xx_end_date IS NULL THEN '' 
        ELSE CONVERT(varchar, xx_end_date) 
    END 
FROM 
    [dbo].[DimDate] // yourtablename
WHERE 
    xx_end_date IS NULL OR xx_end_date &amp;gt; GETDATE()&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;The final output is shown in the following figure:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Xianda Tang&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 05:35:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-01-18T05:35:24Z</dc:date>
    <item>
      <title>Datamart SQL and SYSDATE</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3643698#M32462</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking at developing a datamart and have pulled in tables from Oracle, I want to write a SQL statement for a table using&amp;nbsp;&lt;/P&gt;&lt;P&gt;xx_end_date is null or xx_end_date &amp;gt; sysdate&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not working on the datamart SQL. Does anyone have a solution to this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 14:17:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3643698#M32462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-17T14:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Datamart SQL and SYSDATE</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3644969#M32472</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It seems that the SQL statement you provided is not working on the datamart SQL. One possible solution is to use the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;function to check for null values and then convert the date to a string so it doesn’t try to convert ‘’ to a date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is my table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;The following SQL might work for you:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SELECT 
    CASE 
        WHEN xx_end_date IS NULL THEN '' 
        ELSE CONVERT(varchar, xx_end_date) 
    END 
FROM 
    [dbo].[DimDate] // yourtablename
WHERE 
    xx_end_date IS NULL OR xx_end_date &amp;gt; GETDATE()&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;The final output is shown in the following figure:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Xianda Tang&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 05:35:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3644969#M32472</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-18T05:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Datamart SQL and SYSDATE</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3652048#M32510</link>
      <description>&lt;P&gt;Didn't need to convert null to a date, just needed to use GETDATE( ) instead of SYSDATE( )&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 15:48:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Datamart-SQL-and-SYSDATE/m-p/3652048#M32510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-22T15:48:08Z</dc:date>
    </item>
  </channel>
</rss>

