<?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 Column name and Datetime format error while importing data from SQL server in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701650#M25785</link>
    <description>&lt;P&gt;I am trying to import certain columns from MYSQL server and I want to change the format for Datetime fields to 'YYYY-MM-DD HH:MM' and also I need space between column names as the report that uses the data has similar format.&lt;/P&gt;&lt;P&gt;I am trying something like this but seems to ran into error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CONNECT TO xxx AS xxxx (noprompt = "server=xxxxx ;DRIVER=SQL Server;Trusted Connection=yes;DATABASE=xxxx;");
CREATE TABLE X AS
	SELECT * FROM connection to A
	(
	SELECT t1.SAS data1,
		   t1.DateTime format=NLDATMS19. As DueDatetime
	FROM xxx.xxxx as t1
	);
DISCONNECT FROM xxxx;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Nov 2020 18:42:44 GMT</pubDate>
    <dc:creator>John04</dc:creator>
    <dc:date>2020-11-25T18:42:44Z</dc:date>
    <item>
      <title>Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701650#M25785</link>
      <description>&lt;P&gt;I am trying to import certain columns from MYSQL server and I want to change the format for Datetime fields to 'YYYY-MM-DD HH:MM' and also I need space between column names as the report that uses the data has similar format.&lt;/P&gt;&lt;P&gt;I am trying something like this but seems to ran into error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CONNECT TO xxx AS xxxx (noprompt = "server=xxxxx ;DRIVER=SQL Server;Trusted Connection=yes;DATABASE=xxxx;");
CREATE TABLE X AS
	SELECT * FROM connection to A
	(
	SELECT t1.SAS data1,
		   t1.DateTime format=NLDATMS19. As DueDatetime
	FROM xxx.xxxx as t1
	);
DISCONNECT FROM xxxx;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Nov 2020 18:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701650#M25785</guid>
      <dc:creator>John04</dc:creator>
      <dc:date>2020-11-25T18:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701659#M25786</link>
      <description>In that nested SELECT query, that needs to be your MYSQL code, not SAS code. So format won't work in that one. I would bring it in raw first, and then reformat on the SAS side, in your select * from connection statement or in a second step.</description>
      <pubDate>Wed, 25 Nov 2020 19:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701659#M25786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-25T19:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701663#M25787</link>
      <description>Thanks. I did try that and it seems to work well. The problem that occurs is when I try to schedule it in SAS Management Console, it shows error because of the white space in the column names.</description>
      <pubDate>Wed, 25 Nov 2020 19:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701663#M25787</guid>
      <dc:creator>John04</dc:creator>
      <dc:date>2020-11-25T19:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701668#M25788</link>
      <description>&lt;P&gt;Please post the SAS log of the scheduled job.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 19:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701668#M25788</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-25T19:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701671#M25789</link>
      <description>How are you referring to the variable? I'm guessing you're then running your batch process through a separate install that has slightly different options. &lt;BR /&gt;&lt;BR /&gt;You can refer to it as :&lt;BR /&gt;&lt;BR /&gt;"my variable"n - quotes and N are required. &lt;BR /&gt;&lt;BR /&gt;Example: &lt;BR /&gt;&lt;BR /&gt;proc sql; &lt;BR /&gt;select  date as "Trading Day"n from sashelp.stocks;&lt;BR /&gt;quit;</description>
      <pubDate>Wed, 25 Nov 2020 19:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701671#M25789</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-25T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701685#M25793</link>
      <description>The problem is when I try to run it manually, it doesn't show any error. However, when I schedule it in SMC, it doesn't recognize some column names and stops which is why I dont have SAS log.&lt;BR /&gt;&lt;BR /&gt;The error in my log.txt is Column var name could not be found in the table/view identified with the correlation name T1.</description>
      <pubDate>Wed, 25 Nov 2020 20:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701685#M25793</guid>
      <dc:creator>John04</dc:creator>
      <dc:date>2020-11-25T20:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701686#M25794</link>
      <description>&lt;P&gt;Looks like your BatchServer runs with VALIDVARNME=V7, and your workspace server with VALIADVARNAME=ANY.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 20:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701686#M25794</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-25T20:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Column name and Datetime format error while importing data from SQL server</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701694#M25795</link>
      <description>Agreed. And my guess is the variable name in the batch would then have underscores instead of the spaces. Or you can add options validvarname=ANY to the top of your program and see what happens.</description>
      <pubDate>Wed, 25 Nov 2020 20:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Column-name-and-Datetime-format-error-while-importing-data-from/m-p/701694#M25795</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-25T20:44:52Z</dc:date>
    </item>
  </channel>
</rss>

