BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
paulsparrow
Obsidian | Level 7

I am trying to separate the time from a datetime stamp field in a passthrough query.  I am getting an error that it doesn't recongnize the command 'timepart'

 

PROC SQL ;
CONNECT TO odbc(dsn = 'xxxx' user = xxxxx pw = xxxx);
CREATE TABLE birds.pn01a AS
SELECT
*
FROM
connection to odbc
(
SELECT TOP 100
c.ELG_CUSTOMER_BUS_KEY AS Customer_Id,
p.PRODUCT_CATEGORY_NAME,
p.PRODUCT_BRAND_NAME,
p.PRODUCT_SUB_BRAND_NAME,
p.product,
f.DATE_KEY,
timepart(f.transaction_date) as time_,
f.transaction_date,
f.transaction_hour,
f.transaction_minute,
f."BET AMOUNT" AS Bet_Amt,
f."NET SALES AMOUNT" as Net_Sales,
f.transaction_cnt AS Games_Played

 

ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]'timepart' is not a recognized built-in function name. :
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.

1 ACCEPTED SOLUTION

Accepted Solutions
r_behata
Barite | Level 11

Try using SQL Server syntax inside Pass-thru query.

 

PROC SQL ;
CONNECT TO odbc(dsn = 'xxxx' user = xxxxx pw = xxxx);
CREATE TABLE birds.pn01a AS
SELECT
*
FROM
connection to odbc
(
SELECT TOP 100
c.ELG_CUSTOMER_BUS_KEY AS Customer_Id,
p.PRODUCT_CATEGORY_NAME,
p.PRODUCT_BRAND_NAME,
p.PRODUCT_SUB_BRAND_NAME,
p.product,
f.DATE_KEY,
CONVERT(TIME,f.transaction_date) as time_,
f.transaction_date,
f.transaction_hour,
f.transaction_minute,
f."BET AMOUNT" AS Bet_Amt,
f."NET SALES AMOUNT" as Net_Sales,
f.transaction_cnt AS Games_Played



View solution in original post

1 REPLY 1
r_behata
Barite | Level 11

Try using SQL Server syntax inside Pass-thru query.

 

PROC SQL ;
CONNECT TO odbc(dsn = 'xxxx' user = xxxxx pw = xxxx);
CREATE TABLE birds.pn01a AS
SELECT
*
FROM
connection to odbc
(
SELECT TOP 100
c.ELG_CUSTOMER_BUS_KEY AS Customer_Id,
p.PRODUCT_CATEGORY_NAME,
p.PRODUCT_BRAND_NAME,
p.PRODUCT_SUB_BRAND_NAME,
p.product,
f.DATE_KEY,
CONVERT(TIME,f.transaction_date) as time_,
f.transaction_date,
f.transaction_hour,
f.transaction_minute,
f."BET AMOUNT" AS Bet_Amt,
f."NET SALES AMOUNT" as Net_Sales,
f.transaction_cnt AS Games_Played



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
  • 1 reply
  • 768 views
  • 1 like
  • 2 in conversation