Data Statements - formatting with INSERT statement

Provides intelligent code completion for SQL Server editors.

Moderators: JonathanWatts, David Atkinson, Anu Deshpande, Paul Stephenson, Michelle Taylor, Mike Upton, justin.caldicott, Aaron Law

Data Statements - formatting with INSERT statement

Postby webrunner » Tue Apr 09, 2013 9:16 pm

Hi,

I want to format an INSERT SQL statement with a SELECT statement (not a VALUES statement) without having each column on a new line.

When I highlight the code and choose Format SQL, it puts multiple SELECT statement columns on one line but not the INSERT statements.

For example:
Code: Select all
INSERT INTO MyTable ([col1],
[col2],
[col3],
[col4])
SELECT col1, col2,
col3, col4
FROM MyOtherTable


Is there an option to have the query look like this, with both INSERT and SELECT columns more than 1 to a line?
Code: Select all
INSERT INTO MyTable ([col1], [col2],
[col3], [col4])
SELECT col1, col2, col3, col4
FROM MyOtherTable


I tried looking at the options for Data Statements but can't get it to work.

Thanks for any help.

- webrunner
webrunner
 
Posts: 13
Joined: Tue Apr 19, 2011 3:45 pm

Postby Manfred.Castro » Wed Apr 10, 2013 11:57 pm

Can you try the following.
In SQL Prompt 5 > Options > Data Statements
Uncheck "Each subsequent column" in New lines.
Manfred Castro
Product Support
Red Gate Software
Manfred.Castro
 
Posts: 209
Joined: Mon Apr 23, 2012 2:49 pm


Return to SQL Prompt 5

Who is online

Users browsing this forum: No registered users and 0 guests