BookmarkSubscribeRSS Feed
xiang
Calcite | Level 5

sas 9.2, sql server 2008 r2,odbc=sql server native client 10.0

data destlib.tab;    --sql server database

set sourcelib.tab;  --local sas dataset

run

one column in sourcelib.tab is time8 type with values such as 17:37:33. after running the script above, the column in the sql server database has type datetime2(0) and the value becomes 1960-01-01 17:37:33.

 

another system

sas 9.4, sql server 2012, odbc=sql server native client 11.0

same script

the column in the sql server database becomes time(7) with the value 17:37:33.0000000

 

Could someone please tell me why the first scenario happens and where the control is? Thanks

3 REPLIES 3
PGStats
Opal | Level 21

Look at dataset option DBTYPE, something like data destlib.tab(DBTYPE =(myVar='time(7)'));

PG
xiang
Calcite | Level 5

Hi PG

 

Thanks for your reply. Do you know why the first case happened? is it because of some sort of default option?

 

Thanks


Xiang

PGStats
Opal | Level 21

I don't know. To SAS, TIME. and DATETIME. are representations of the same quantity : the number of seconds since 01JAN1960:00:00:00. I guess things just got more sophisticated between versions 9.2 and 9.4.

PG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1102 views
  • 0 likes
  • 2 in conversation