Hilite and execute, stacking sql in macros

Database
Enthusiast

Hilite and execute, stacking sql in macros

Hi,

ms sql has a feature where you can be looking at a lot of sql code, hilite one section of it and hit f5 and it will only run that piece of code. Does the teradata sql assistant r13.x do that in some other way?

a related question. Teradata macros seem to do only one sql action per macro. Like I can't do 10 different selects in one macro. I have tried semicolons at then end of a selects, I have tried putting END in. Is there some way to do multiple sql actions in a macro? bteq seems more flexible this way.
Tags (2)
4 REPLIES
Junior Contributor

Re: Hilite and execute, stacking sql in macros

1. There's an option "submit only selected query text when highlighted" in options - query
For some historical reason it's unchecked by default.

2. Of course you might have multiple DML statements witin a single macro, you might even exec a macro within a macro.
Each statement must be terminated by a semicolon, you already tried that, so there must be some other error.

replace macro testmacro as
(select .....;
select .....;
select .....;
);

Dieter
Enthusiast

Re: Hilite and execute, stacking sql in macros

Dieter, my sql assistant has only little buttons, none of which say "options". Is there some command to get menus for the sql assistant gui?

I did multiple selects in a macro and that worked, thanks. If do something more complex like
create volitile table xtempc as (
select ....
)
WITH DATA ON COMMIT PRESERVE ROWS ;
They don't seem to stack. Like creating 3 or 4 temp tables in one macro. Do I need to use more semicolons?
Junior Contributor

Re: Hilite and execute, stacking sql in macros

No menu?
I didn't know you could hide the Menubar...

Try ALT-T for the Tools menu.
Or right click any toolbar and choose Customize, in the Options tab there's a "Reset my usage data" button, maybe it helps.

There may be multiple DMLs but just a single DDL within a macro, you need a Stored Procedure for that.
Semicolons don't help here :-)

Dieter
Enthusiast

Re: Hilite and execute, stacking sql in macros

Dieter, Thanks, alt-t did the trick. The menu came up separate from the sql assistant window. When I dragged the disjoint menu back to the sql assistant window, the menu items stayed in sql assistant even after logon/logoff. With that I was able to get the "execute only hilite" feature working.

I understand about only one ddl per macro. I'll take a look at stored procedures.