03-02-2017 04:12 PM
I am trying to export my SAS data sets to SQL Server. There are 3 date columns in my table. However, I am facing a data type mismatch issue. I have created an empty table with all required columns on SQL Server. The Date columns on SQL Server have the datatype Date. Please find below my code to transfer SAS data to SQL Server:
Connect to odbc(datasrc="data" user=Writer password=Writer);
INSERT INTO SQL.Database
WHERE ID IS NOT NULL;
disconnect from odbc;
Please find code I used on SQL server to create blank table (there are more columns than these three):
CREATE TABLE database
The format and informat of SAS Date columns is MMDYY10. How do I move data from SAS Date columns to the three Date columns on SQL Server?
03-02-2017 04:22 PM
I'm assuming you've already searched and tried the standard solutions.
So what happens if you use Date9 or a datetime type/format instead?
03-02-2017 04:36 PM
Apply a format...
That code you showed wouldn't work, because when you use SQL pass through you don't have access to your SAS Database.
Format variable_name date9.;
03-03-2017 01:38 AM - edited 03-03-2017 01:40 AM
Here's the documentation explaining the default data type translations:
What is the mismatch you are getting?