184 results found
-
Indent FROM clause
Allow the FROM, WHERE, GROUP BY, etc. clauses to indent from the select.
Change
SELECT Col1,
Col2
FROM Tab1
WHERE a = bTo
SELECT Col1, Col2 FROM Tab1 WHERE a = b
3 votes -
restore from url breaks SQL formatter
The below script causes SQL Formatter rules to fail with the error "Script parsing error(s) ... Incorrect syntax near url. ... Failed refactorings: Insert semicolons (Script parsing errors)"
create database foo; go backup database foo to url = N'https://foocorp.blob.core.windows.net/backups/foo/foo_1.bak'; go restore database foo from url = N'https://foocorp.blob.core.windows.net/backups/foo/foo_1.bak'; go
SSMS Parse (
ctrl+F5
) reveals that this snippet parses correctly. When replaced with a valid URL target, this syntax also executes without error.Please update the semicolon rule and any other necessary rules to handle for backup/restore from URL as a valid formattable syntax.
(possibly related? https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/40184173-format-sql-backup-to-url-with-credential-breaks-co)
1 vote -
Option to align AND conditions with ON clause
Would love to have the option to have all conditions (AND / OR) aligned (or same indentation) with the ON clause, for example:
FROM dbo.orders AS o
JOIN dbo.orderAttributes AS oa
~~ON oa.companyID = o.companyID
~~AND oa.orderID = o.orderID5 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 -
Option to prevent removal of brackets on database and server names
Removing brackets from database names causes VS schema compare to indicate file differences because VS requires database reference variables to be enclosed in brackets. Need an option to exclude removal of brackets from database and server in three and four part names.
6 votes -
Switch between Alias formats AS/=
A formatting feature to change syntax between these two forms
SELECT field1 AS Alias1, field2 AS Alias2 FROM table1
SELECT Alias1 = field1, Alias2 = field2 FROM table1
Ideally useable without having to invoke the "Format SQL" command.
Hopefully selectable as an enabled option within a Format SQL style set.I spend a non-trivial amount of time reformatting SQL code for leading/trailing comma placement and alias AS/= placement, this would be a HUGE help
7 votes -
Additional options for formatting a GROUP BY clause
It would be appreciated if you could enhance the SqlPrompt Formatting Styles functionality. I believe this would go in the STATEMENTS >>> Data (DML) section.
I'd like to continue using the "If there are multiple expressions" item of the "Place GROUP BY / ORDER BY expression on new line" drop-down. But I'd like those expressions to be indented; they presently all left-align to the GROUP BY.
Also, while you're there, it seems that it would be good to also have add an "If longer than wrap column" option to the above-mentioned drop-down.
2 votes -
Additional options for formatting the ON constraints of a JOIN
It would be appreciated if you could enhance the SqlPrompt Formatting Styles functionality for the Clauses >>> JOIN section. I'd like the ON keyword to stay on the same line as the table-name, but when constraints are line-wrapped, I'd just like them to be "normally" indented.
Presently, the only way to get close to this behavior is to check the "Place ON keyword on new line" checkbox and set "ON keyword alignment" to "Indented". But I don't want that box checked.
3 votes -
Refactoring an INSERT statement into an UPDATE statement with SELECT
Be able to refactor INSERT statement into UPDATE statement that has SELECT rather than VALUES i.e. "insert into xxx select from".
2 votes -
DDL Parentheses Formatting should apply to VALUES clause of INSERT Statements - Bug?
The current parenthesis options I have set for an INSERT INTO (DML) statement, only appear to work for the list of columns, but NOT for the list of values in the VALUE clause. I'm unsure why this behaviour is different, but this inconsistency seems like a bug.
I have provided a screenshot where you can clearly see the parentheses are not aligned correct in comparison with the INSERT statement.
Ultimately I would like for the formatting to be overall consistent.
2 votes -
Unformat Query
Add a menu Item option to unformat a query. In other words take the query that is highlighted or every query in the script and convert them to be on a single line with only a single space between keywords, words, and operators.
This would be very useful for having to copy SQL into a table or other some object that shouldn't have normal formatting in it.
An option would be to double up all single quotes, so that the query can be placed between single quotes.6 votes -
Properly format the start of a CTAS in Azure Synapse Analytics
SQL Prompt does not start a new line for the SELECT portion of a CTAS statement within Azure Synapse Analytics when there is a defined distribution or index using a WITH clause. Instead the SELECT statement is tabbed way over to the right.
6 votes -
Table Column Format Correction
In cases where there is SELECT DISTINCT or SELECT TOP(n) .. I would l like the option to format my table's columns to appear on the next line and indented 1 tab or set of spaces in from the SELECT and not necessarily aligned with DISTINCT or TOP in the line above.
SELECT DISTINCT
COLUMN1,
COLUMN2
FROM ...instead of
SELECT DISTINCT
Column1,
Column2
FROM ...3 votes -
Use formatter to create table of contents
It would be great to be able to use the formatter to create an automated table of contents based on some recognized commented pattern. For example, I could begin each section of code with:
--******
-- Title of section
--******Then after using the formatter it would see the commented section and add the line number for each section in the beginning of the script. I imagine something similar to MS Word's auto generated table of contents.
1 vote -
Ability to choose schema when there are multiple objects with the same name exists
Currently when SQL code is formatted, it will pick the first schema, if there are multiple objects with same name but having different schemas. It would be good if the choice is given to the user to choose which schema.objectname to use in this case.
Also it's better if we can exclude certain schema's to be considered during code format. (But want to see the intellisense. Only to exclude them during the code format)
3 votes -
Find invalid objects in script
Highlighting invalid objects is a nice feature, but it would also be nice to "find" invalid objects in a script.
Running SQL Format on a script with an invalid object in it runs fine and gives no error, it just doesn't prefix the object (like a table) with the schema.
It would be nice to have a quick and easy way to "go to next invalid object" or even for when you run SQL Format to have it bring up a warning saying "this/these object/s appear to be invalid".3 votes -
Stop OPENJSON after CROSS APPLY from showing up on new line
I have included a Sample SQL script. This script shows the desired formatting. I can't find any way to prevent the OPENJSON from being sent to a new line. For example:
SELECT *
FROM OPENJSON(@JSON, '$.Doc') AS OJ
CROSS APPLY OPENJSON(OJ.Value)
WITH (ID int) AS CAOJbecomes
SELECT *
FROM OPENJSON(@JSON, '$.Doc') AS OJ
CROSS APPLY
OPENJSON(OJ.Value)
WITH ( ID INT ) AS CAOJ2 votes -
Allow block comments /* SQL Prompt formatting off */ to disable T-SQL formatting
SQL Prompt should allow block comments /* SQL Prompt formatting off */ to disable T-SQL formatting.
Single line comments are a pain when tuning queries. I would always use block comments in my code except when I don't want SQL Prompt to not mess with certain T-SQL it does not format to my standards.
Blocking formatting should support both type of comments.
/* SQL Prompt formatting off */
-- SQL Prompt formatting off8 votes -
SQL Prompt Support for Azure Synapse (Azure SQL Data Warehouse)
Please add support for
SQL Prompt Support for Azure Synapse (Azure SQL Data Warehouse)46 votes -
"Insert Semicolons" feature should add Semicolon after "BEGIN"
When using a BEGIN/END block, the "Insert Semicolons" feature adds a semicolon after "END" command, but not after the "BEGIN" command.
One reason why this should be done, is the use of the THROW statement, which requires the previous statement to be terminated with a semicolon.
Technically it is still runnable code, but, SSMS (as of version 18.8) sees it as a syntax error (see screenshot).
I don't know which is the appropriate fix...waiting for SSMS to fix the syntax error it shows (but I doubt they will since the non-use of semicolons is deprecated), or if it's appropriate for…
3 votes
- Don't see your idea?