BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
IgawaKei29
Quartz | Level 8

I have been looking at this code syntax for hours, the Teradata code runs in a different environment, but bringing it through Enterprise Guide is giving me issues.  The error I am getting is: ERROR: Teradata execute: Syntax error: expected something between ')' and ';'.  I can't seem to figure out what the issue is.  I appreciate any help or insight on this.

 

PROC SQL NOERRORSTOP;
CONNECT TO TERADATA (AUTHDOMAIN=xx  server="xxx" connection=global mode=teradata);
  execute (drop table TestServer.Test3) BY Teradata;
  execute (create table TestServer.Test3 as
  
(
select *
from TestServer.Test1

UNION ALL

select * 
from TestServer.Test2

))BY Teradata;
 quit;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

In Teradata syntax there are two key things you have left out.

 

1) At the end of the CREATE TABLE statement you need some like WITH DATA (look up the syntax I don't remember it exactly) if you actually want the data to be saved.

2) Teradata is a highly parallel setup.  It does this by partitioning the data with a PRIMARY INDEX.  You want a primary index that does not skew the data so that only some of the "nodes" have all of the data.  If you do not specify the PRIMARY INDEX then it will pick the first variable.  Which might be a very poor choice.  

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

Try it without the extra brackets:

PROC SQL NOERRORSTOP;
CONNECT TO TERADATA (AUTHDOMAIN=xx  server="xxx" connection=global mode=teradata);
  execute (drop table TestServer.Test3) BY Teradata;
  execute (create table TestServer.Test3 as
select *
from TestServer.Test1
UNION ALL
select * 
from TestServer.Test2
) BY Teradata;
 quit;
IgawaKei29
Quartz | Level 8
I tried without the extra brackets and got the message:
ERROR: Teradata execute: Syntax error, expected something like a name or a Unicode delimited identifier or '(' between the 'as'
keyword and the 'select' keyword.
Tom
Super User Tom
Super User

In Teradata syntax there are two key things you have left out.

 

1) At the end of the CREATE TABLE statement you need some like WITH DATA (look up the syntax I don't remember it exactly) if you actually want the data to be saved.

2) Teradata is a highly parallel setup.  It does this by partitioning the data with a PRIMARY INDEX.  You want a primary index that does not skew the data so that only some of the "nodes" have all of the data.  If you do not specify the PRIMARY INDEX then it will pick the first variable.  Which might be a very poor choice.  

IgawaKei29
Quartz | Level 8
Thank you! That was it.. I was missing the With Data and Primary Index! Really appreciate the help.

) with data primary index(id)) by teradata;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 297 views
  • 2 likes
  • 3 in conversation