All Forums Teradata Studio
brettbates 19 posts Joined 04/13
03 Jul 2014
Unable to Inlcude Code Comments in Views within Teradata Studio

When running script for view creation during deployments, our development teams write the scripts so that there are multiple views in a script and each view includes a comment header as shown below. I have tried everything I can think of in Teradata Studio to get this to run to include the comments in the view, running all REPLACE view statements, a select few and even changing options; however, the comments are always stripped out. This was not an issue in SQL Assistant and I need to make sure that this does not happen as these headers are essential to define the view information. I understand that SQL Assistant is ODBC and Teradata Studio is JDBC and thought that this may be the reason they are handled this way, but was not sure. Any ideas on how to make this work in Teradata Studio of if it is possible?
/***************************************************** *********************
 *Program Name:       BLAH
 *Teradata View Type: ETL View
 *    CC Change View - finds changed rows by comparing source to target
 *Date Created: 2010-11-03 17:34:17
 ****************************************************** ********************/

SELECT . . .

Brett B.

Brett Bates
Chuckbert 78 posts Joined 07/09
03 Jul 2014

Since you've got multiple CREATE VIEW statements in your script, the statements have to be run individually. It appears to me that you've got the statements in a SQL Editor in Studio and are running the SQL in the editor using the "Execute as Individual Statements" action (either with the run button in the editor's toolbar, in in the editor's context menu or in the main window's toolbar or SQL menu). Multiple DDL statements have to be run individually. Studio parses the contents of the editor to find the individual statements and executes the individual statements in separate transactions.
What it has done is it uses the text from the first token of the statement (the CREATE keyword) through the end of the statement (the semicolon) for each of the statements. This does not include the whitespace (which includes comments) that precedes or follows the statements.
What you can do for now is to execute the statements individually yourself rather than relying on Studio to split the statements. You can do this by selecting a statement, including its comment, and use the SQL Editor's "Execute Selected Text as One Statement" context menu item to run the statement. And do it for each statement in the editor. When you execute statements this way, the entire selected text is what gets run and will include the comments.
We will change Studio to include the whitespace that precedes each statement when it is splitting the statements to be run individually.

brettbates 19 posts Joined 04/13
03 Jul 2014

Hi Chuck;
Unfortunately, running the statements individually would be much too time consuming as there can be hundreds of views in a single script for a deployment, so I will have to use SQL Assistant until Teradata Studio has been modified to work this way.
Do have any idea the timeframe for implementation for this feature?

Brett Bates

You must sign in to leave a comment.