Remove Blank Lines

Teradata Studio
N/A

Remove Blank Lines

Looking for a solution for removing blank lines from a query within TeraData Studio's Query Development tab. The blank lines are showing up when I try and Show the DDL of particular views. 

 

From a quick Google search I found that SQL Assistant contains the ability to quickly remove a bunch of blank lines from a query. http://www.info.teradata.com/HTMLPubs/DB_TTU_13_10/index.html#page/Storage_Management/B035_2430_020A...

 

I've also found that the Format SQL command under the Edit menu in TeraData Studio removes many of the blank lines, but I'm still left with quite a few (between join, on and and, etc.)

 

1) Is there a surefire way to remove the blank lines?

2) Is there any setting I need to change to stop the blank lines from happening in the first place?

 

 


Accepted Solutions
Teradata Employee

Re: Remove Blank Lines

Studio's editor's Find/Replace dialog has the ability to search for Regular expressions. If you open the Find/Replace dialog and check the Regular expressions checkbox, you can put the following in the Find field:

\R\s*\R

And this in the Replace with field:

\R

The "\R" says to search for the platform's Line Delimiter and the "\s*" says to include all white space characters between the line delimiters in the search. The Replace field says to replace everything between line delimiters when there are only spaces, tabs, line delimiters, etc. between them with a single line delimiter. The result of pressing "Replace All" should be the text with no blank lines.

 

Since you say that you're trying to remove blank lines included in the SHOW ddl command, the result of SHOW might have line delimiters for a platform other than what you're running on. In that case, you might need to have the "\R" parts of the Find field use "\n" (for Newline character), "\r" (for CR character) or a combination of the two.

1 ACCEPTED SOLUTION
2 REPLIES

Re: Remove Blank Lines

Half answer: not sure about the tooling, but I normally use Notepad++ to remove blank lines, convert between CRLF of Windows/Linux etc...

Teradata Employee

Re: Remove Blank Lines

Studio's editor's Find/Replace dialog has the ability to search for Regular expressions. If you open the Find/Replace dialog and check the Regular expressions checkbox, you can put the following in the Find field:

\R\s*\R

And this in the Replace with field:

\R

The "\R" says to search for the platform's Line Delimiter and the "\s*" says to include all white space characters between the line delimiters in the search. The Replace field says to replace everything between line delimiters when there are only spaces, tabs, line delimiters, etc. between them with a single line delimiter. The result of pressing "Replace All" should be the text with no blank lines.

 

Since you say that you're trying to remove blank lines included in the SHOW ddl command, the result of SHOW might have line delimiters for a platform other than what you're running on. In that case, you might need to have the "\R" parts of the Find field use "\n" (for Newline character), "\r" (for CR character) or a combination of the two.