- or
166 results found
-
Allow LEFT, RIGHT, INNER and OUTER JOINS to be right-aligned to SELECT.
Currently, FROM, WHERE, JOIN, and ODER can all be right-aligned to SELECT when formatting SQL. However, if you introduce a LEFT JOIN, the LEFT keyword is right-aligned to SELECT, and everything else is pushed over to make room for the JOIN. This is hideous and makes no sense.
Instead, allow the entirety of "LEFT JOIN", "RIGHT JOIN", "INNER JOIN" and "OUTER JOIN" to right-align to the SELECT keyword.
The attached images explain it better than I can.
6 votes -
Allow the option for SQL formatting of nested inner join on an outer join to indent the nested inner join.
When you have a nested inner join to an outer join, such as:
SELECT a., b., c.*
FROM
A a
LEFT JOIN B b
INNER JOIN C c on b.bid = c.bid
ON a.aid = b.aidIt should allow an option to indent the nested join further to show that it is nested
5 votesWe’ve released support for indenting nested joins in version 8 of SQL Prompt as part of our new formatting system.
You can get the latest version of SQL Prompt from https://www.red-gate.com/products/sql-development/sql-prompt/.
If there is something missing please let us know by opening a new suggestion.
Kind regards,
The Prompt Team
-
Align ON in JOIN Statements
I really like the latest formatting flavours. Aligning the equivalency symbols in joins is nice, but could I also align the ON keyword? Or pick which one I want to align on.
SELECT *
FROM table1 a
JOIN Table2 b__ON a.foo = b.foo
JOIN Tab3 c___ ON b.fa__= c.fa24 votes -
Have formatting features for cross join match those of left/right/inner join
I have set up rules to format as such:
Select *
From Employees e Join
People p On e.PersonID = p.PersonID;Each table/view object aligned on a new line. However, when I convert to a "cross join", they don't generate a new line, they concatenate on the same line, like such:
Select *
From Employees e Cross Join People p;3 votes -
format join
I would like the ability to get Format SQL to handle my JOIN formatting - I like to have my JOINs look like this:
SELECT
(columns)
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECTID = i.objectidThat is: I want to have my tables being joined lined up with the (intended) table in the FROM clause, and I like to have my JOIN condition on the same line as the joined table.
Right now, I cannot seem to get this to work - the table name and join condition are always stuck onto the…
7 votesThis feature was released in version 8 of SQL Prompt.
If there are any missing features please let us know by creating a new suggestion.
Kind Regards,
The Prompt Team -
Align equals sign in UPDATE
Provide an option in Styles to let the right hand side of clauses in UPDATE statement be aligned.
Example:
UPDATE~~EDSV
SET~~~~~eDocSessionID~~~~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionID~,
~~~~~~~~eDocSessionKey~~~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionKey~,
~~~~~~~~eDocSessionValue~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionValue~,
~~~~~~~~eDocSessionValueTextStyleOverride~=~CONSV.eDocSessionValueTextStyleOverride~,
~~~~~~~~eDocSessionValuePositionOverride~~=~CONSV.eDocSessionValuePositionOverride~,
~~~~~~~~eDocSessionValueLockdown~~~~~~~~~~=~''
FROM~~~~eDocStd2.dbo.eDocSessionValues~AS~EDSV
~~~~~~~~INNER~JOIN~#changedOrNewSessionValues~AS~CONSV~ON~CONSV.eDocSessionID~=~EDSV.eDocSessionID
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~AND~CONSV.eDocSessionKey~=~EDSV.eDocSessionKey;44 votes -
Mark same columns in JOIN conditions
It helps avoiding join on the same column (especially at inner join).
Example:
UPDATE A SET Column1 = B.Column2 FROM TableA AS A INNER JOIN Table B ON A.Column3 = A.Column3.
It happens usually by accident. The statement should be:
UPDATE A SET Column1 = B.Column2 FROM TableA AS A INNER JOIN Table B ON A.Column3 = B.Column3.14 votes -
Format Join Order
On our team we are very particular about the order of our joins as they are written in the query. I would like to request an option to format joins so the table you are joining on is the first item in the join. In the example below you join to tableb so the first ON clause is tableb, subsequently on the tablec join the first join is on objects from tablec.
SELECT (columns)
FROM tablea a
INNER JOIN tableb b ON
a.id = b.id
INNER JOIN tablec c ON
b.id2 = c.idTo:
SELECT (columns)…2 votes -
align aliases
Please, separate options to align aliases for columns and tables..... I love aligned column aliases, but table aliases advance too far right, unnecessarily.
8 votes -
Align tables within FROM clause
Currently, I can get SQL Prompt to format my SQL like this.
SELECT
tbl.name AS TableName,
col.name AS ColumnName
FROM
sys.tables AS tbl
INNER JOIN
sys.columns AS col
ON
tbl.objectid = col.objectidThis annoys me because the tables in the FROM statement are not aligned. I would like to be able to achieve something like below where the tables are aligned and the join and ON are indented from the table. So the tables are indented from the FROM and the INNER JOIN is indented from the table. Then, the ON can either be indented from…
1 vote -
Add ability to include earlier tables in the Join Clause
When writing a query that joins to several tables, the Join Clause only seems to look at the previos table to determine what columns can be used to join on. For example, when typing out the following query:
SELECT * FROM [dbo].[employee] AS E
INNER JOIN [dbo].[Department] AS D
ON [E].[DepartmentID] = [D].[DepartmentID]
INNER JOIN [dbo].[Position] AS P
ON ...When I look at the options for the ON clause for the join to Position, it doesn't include any columns being joined back to the Employee table. It would be nice if the suggestions would include at least…
41 votesWe’ve released SQL Prompt 6 which includes all tables in a join clause.
-
Don't suggest join keys I've already used
After I type
SELECT * FROM sys.indexes i
INNER JOIN sys.partitions p
ON i.indexid = p.indexid
ANDthe IntelliSense still suggests me i.indexid = p.indexid which I've already used. These duplicates can become pretty annoying when multiple columns are used for joining
26 votesThank you for your suggestion.
We’ve reviewed this as part of our UserVoice triage.
Currently, we have no plans to implement this feature in the near future. However, if there is sufficient demand in the future, we will revisit it.
Please feel free to send us any additional feedback on these topics by commenting here.
Kind Regards,
The Prompt Team -
Allow indentation similar to nested JOIN when they are not written as nested
A nested join is indented additionally relative to the join that it is nested within:
SELECT *
FROM Person.Address
--INNER JOIN Person.StateProvince
----INNER JOIN Sales.SalesTerritory
------ON SalesTerritory.TerritoryID = StateProvince.TerritoryID
----ON StateProvince.StateProvinceID = Address.StateProvinceIDWhen joining the same tables but not writing them in a nested manner, there is no additional indentation:
SELECT *
FROM Person.Address
--INNER JOIN Person.StateProvince
----ON StateProvince.StateProvinceID = Address.StateProvinceID
--INNER JOIN Sales.SalesTerritory
----ON SalesTerritory.TerritoryID = StateProvince.TerritoryIDIt would be nice to allow the same amount of indentation that would be used if the join were nested to be used when it is…
1 vote -
Ability to flip the sides in an auto generated join clause
When I write a join statement I put the last table that I am joining to the other tables on the left side of a join clause. For example:
SELECT *
FROM tblOrder o
INNER JOIN tblIOrder_Detail d
ON d.OrderID = o.OrderID
The auto-generated join clause would be "ON o.OrderID = d.OrderID". It would be nice if it was possible to customize this behaviour to choose which side there will be each table/alias on.Thanks
27 votesWe’ve released SQL Prompt 6 which includes an option to swap the order of columns in join clauses.
-
Align "then"
Please add an option to align "then" keyword and the expressions.
Current format:
declare@fooidint=(case
_______________________when@barId=7then2
_____________________when@barId=800then1
_____________________else5
_________________end
__________________);Suggested format:
declare@fooidint=(case
_______________________when@barId=7then2
____________________when@barId=800_then1
_____________________else________________5
________________end
__________________);14 votes -
Add NULL to JOIN suggestions
When joining two tables, you today get the option to join on known references or identical column names.
What I would like to see is an extra join option in the suggestions, if both the columns are NULLable:
SELECT * FROM table1
INNER JOIN table2 ON (table2.ref1ID = table1.ref1ID OR (table2.ref1ID IS NULL AND table1.ref1ID IS NULL)The above example might seem like rubbish at first! But sometimes when you have composite keys, one of the columns in the key might very well be a NULLable value.
So a more valid example would be:
SELECT * FROM table1
INNER…1 vote -
Be able to add space between two right parentheses
When I have two right parentheses next to each other like in a query like this (in the OPTION clause)
SELECT Columns
FROM TableA
INNER JOIN TableB
ON TableA.Key = TableB.Key
OPTION( USE HINT( N'FORCEDEFAULTCARDINALITY_ESTIMATION' ) )There doesn't appear to be an option to have the space between the two right parentheses at the end. I have tried checking/unchecking quite a few boxes in the formatting style editor, and I don't think anything is controlling this. To me, the "add spaces around parentheses contents" option should put a space between the two right parentheses, but it doesn't.
12 votesHi Jake,
Thanks for reporting this. The team have reviewed the suggestion and we think it’s a bug rather than a feature suggestion.
If you’d like to submit this as a ticket into our support team we’ll pick it up from there and action.
-
Align SET statements around = sign
I am a brand new user (1 day) for SQL PROMPT. I managed to get my parameter statements to align, but there is no option on my custom formatting style to align my set statements. See the attached jpg. Trying to get it to look like the yellow highlighted area.
6 votes -
AND keyword for WHERE and JOINs on new line
There is no option in CLAUSES > JOIN to place AND on new line (Right aligned to INNER) and in Data (DML) there isn't an option to put AND on new line. Lots of tables I join on I am joining on 2 columns and I prefer to have the AND a.col1 = b.col1 on a new line as well.
4 votes -
set default join conditions
I work on the same databases on a regular basis. Many do not have foreign keys and do not used identically named column names in tables that I'm joining.
I repeatedly have to specify the same several columns in the join condition.
I'd love a way for SQLPrompt to either remember join clauses I've previously used, or allow me to specify default join conditions for pairs of tables (or both).
8 votes
- Don't see your idea?