<?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 formatting dates for a sql server pass through in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/695996#M212486</link>
    <description>&lt;P&gt;I pulled this date from sql server and tried putting single quotes around it but that didn't work. I saw somewhere that %bquote was used so I tried that too. Any suggestions appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;inobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;connect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SQLSVR (user=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;user.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Password=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;pass.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dsn=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;db.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; members &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; connection to SQLSVR &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; *&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; jkl.table1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; entered_dt &amp;gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'22OCT2018:07:00:00.0000000'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;);&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;disconnect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sqlsvr;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2020 16:58:05 GMT</pubDate>
    <dc:creator>DanD999</dc:creator>
    <dc:date>2020-11-02T16:58:05Z</dc:date>
    <item>
      <title>formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/695996#M212486</link>
      <description>&lt;P&gt;I pulled this date from sql server and tried putting single quotes around it but that didn't work. I saw somewhere that %bquote was used so I tried that too. Any suggestions appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;inobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;connect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SQLSVR (user=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;user.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Password=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;pass.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dsn=&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;db.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; members &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; connection to SQLSVR &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; *&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; jkl.table1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; entered_dt &amp;gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'22OCT2018:07:00:00.0000000'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;);&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;disconnect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sqlsvr;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 16:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/695996#M212486</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2020-11-02T16:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696013#M212490</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;YYYY-MM-DD&lt;/PRE&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;PRE&gt;where entered_dt &amp;gt;= '2018-11-22'&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Nov 2020 18:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696013#M212490</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-11-02T18:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696019#M212496</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12477"&gt;@RichardDeVen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;YYYY-MM-DD&lt;/PRE&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;PRE&gt;where entered_dt &amp;gt;= '2018-11-22'&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The query runs successfully but it doesn't give the correct answer. How do I find&amp;nbsp;rows where the time is after 7AM on that date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696019#M212496</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2020-11-02T19:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696020#M212497</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12477"&gt;@RichardDeVen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;YYYY-MM-DD&lt;/PRE&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;PRE&gt;where entered_dt &amp;gt;= '2018-11-22'&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If I change the datetime to '2020-10-22:07:00:00.0000000' &lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;I get this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: CLI open cursor error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Conversion failed when converting&lt;/P&gt;
&lt;P&gt;date and/or time from character string.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696020#M212497</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2020-11-02T19:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696021#M212498</link>
      <description>&lt;P&gt;A Google search will provide the answer:&lt;/P&gt;
&lt;PRE&gt; '2020-10-22 07:00:00'&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696021#M212498</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-02T19:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696022#M212499</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12477"&gt;@RichardDeVen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;YYYY-MM-DD&lt;/PRE&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;PRE&gt;where entered_dt &amp;gt;= '2018-11-22'&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This works '2020-11-22 07:00:00'. Thanks for getting me on the right track.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696022#M212499</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2020-11-02T19:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: formatting dates for a sql server pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696024#M212500</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49285"&gt;@DanD999&lt;/a&gt;&amp;nbsp; - Please mark the post as answered then.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-dates-for-a-sql-server-pass-through/m-p/696024#M212500</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-02T19:40:20Z</dc:date>
    </item>
  </channel>
</rss>

