186 results found
-
Replace all tabs with spaces
Setting the option to use spaces instead of tabs for intending (our house policy) only works for new tab presses.
I would like a simple action that would replace all tabs in the current document with spaces -- using the tab-to-spaces value as set in options. Sublime Text has this and I use practically every time I edit anything.57 votes -
Create new Setting to only enclose SQL Keywords in square brackets
I don't want to use brackets for my code (unless I have to). So, for example, dbo.Orders is fine, but dbo.Order isn't. It would be nice if SQL prompt caught this and automatically enclosed the SQL Keyword "Order" in square brackets (i.e. dbo.[Order] AS o)
52 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)47 votes -
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 -
Add additional option for "remove unnecessary brackets" which would keep brackets around syntax highlighted words. "Status", "Type",etc.",
Add additional option for "remove unnecessary brackets" which would keep brackets around syntax highlighted words.
"Status", "description", and "Type" are examples of special words that are syntax highlighted, but they aren't full reserved keywords, so would want the brackets kept.How to configure and prevent SQL Prompt from removing brackets around Syntax highlighted words?
We only have the following settings:
a) Options > Inserted Code > Special Characters > Brackets > Enclose identifiers within square brackets [] = NO (which is our desire)
b) Options > Format > Styles > Actions > run format > Add/remove square brackets = YES,…31 votes -
formatting of OVER clause
Would like to control formatting of the OVER clause. E.g I would like the complete "(Partition by ... order by ...) as xyz" on one line, but today it's overrdden by other options.
29 votes -
Align aliases, commas, datatypes and expressions at the next tab stop
I align aliases, commas, datatypes and expressions at the first tab stop following the longest element in the list. See examples below:
-- Tilde character used as space replacement to cope with HTML formatting
-- 2-character tabs are assumed below
-- In a fixed-space font, the commas, = signs, data types and AS keywords would all line up vertically
DECLARE
~~@x~~~~~~~~~~~~~~INT~~~~~~~~~,
~~@var~~~~~~~~~~~~VARCHAR(4)~~,
~~@longer_varname~VARCHAR(10)~,
~~@z~~~~~~~~~~~~~~DATETIME~~~~;SELECT
~~~~@longer_varname~=~'x'~~~~~~~,
~~~~@var~~~~~~~~~~~~=~'1234'~~~~,
~~~~@z~~~~~~~~~~~~~~=~GETDATE()~;SELECT
~~~~T1.shortfield~~~~~~~~AS~ShortField~,
~~~~AO.reallylongfield~~AS~LongField~~,
~~~~'x'~~~~~~~~~~~~~~~~~~~AS~XChar~~~~~~,
~~FROM~~~~~~~~dbo.table1~~~~~~AS~T1
~~~~LEFT~JOIN~dbo.anotherone~AS~AO~ON~T1.keyval~=~AO.keyval;EXEC~@x~=~dbo.SomeProc
~~@Param1~=~'3'~~~~~~~~~~~,
~~@P2~~~~~=~'Longer~Text'~,
~~@P3~~~~~=~4~~~~~~~~~~~~~;26 votes -
Preserve indentation of multiple-line comment blocks
In SQL Prompt 8, multiple-line comment blocks (surrounded by /* */) are automatically indented to the SQL code surrounding them when formatting.
Can you please add an option to preserve the indentation of these blocks? My team keeps most comment blocks left-aligned for consistency and readability, but SQL Prompt will automatically move them when formatting.
This was not an issue in SQL Prompt 7, so all of our comment blocks are now moving when upgrading to SQL Prompt 8 and there is no option to preserve them. Thank you.
23 votes -
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.fa23 votes -
Format dynamic SQL
We use a lot of dynamic SQL. I'd like to be able to format dynamic SQL that is in a string, eg. and NVARCHAR. e.g.
Input: DECLARE @sql NVARCHAR = '
SELECT foo from bar where foobar = ''foobarred''
'I'd like to be able to highlight the text inside the NVARCHAR for formatting. SQL Prompt would need to handle doubled quotation marks as in my example above.
19 votes -
Comment Word Wrap
Hi!
I would be nice to have the option to enable word wrap for the comments as well.
The number of maximum characters for the comment should be aligned with "Wrap lines longer than" for SQL statements.19 votes -
Replace all inline comments with block comments
It would be really useful to be able to choose the default comment style as either inline -- or comment block /* */, and have that style be applied when executing an auto-format on the script.
See https://www.erikdarlingdata.com/sql-server/please-use-block-quotes-for-code-comments-in-your-t-sql/ for more info
17 votes -
Expand a view or views referenced in a query
I think it would be great if SQL Prompt had the functionality to expand a view that is used in a query. So if you have this schema:
CREATE TABLE dbo.Person
(
PersonID INT IDENTITY(1, 1)
PRIMARY KEY,
LastName VARCHAR(30),
FirstName VARCHAR(30),
);
GOCREATE TABLE dbo.Student
(
StudentID INT IDENTITY(1, 1)
PRIMARY KEY,
PersonID INT,
StudentNo VARCHAR(100)
);
GOCREATE TABLE dbo.Class
(
ClassID INT IDENTITY(1, 1)
PRIMARY KEY,
ClassName VARCHAR(100)
);
GOCREATE TABLE dbo.ClassRoster
(
ClassID INT,
StudentID INT
);GO
CREATE VIEW dbo.Students
AS
SELECT
S.StudentID,
P.LastName,
P.FirstName,
S.StudentNo
FROM
dbo.Person AS P
JOIN dbo.Student AS…17 votes -
Format SQL Code on opening file
It would be awsome if there was an option that would format an SQL Script automatically after opening it in SSMS / VS. So if you load a file it would be formatted automatically with your selected formatting style. It would be great too if this auto format option could be switched on and off in the Options.
17 votes -
Suggestion for THIS site
This is a Format SQL request; not for SQL Prompt, but rather for this website. I don't know how many hundreds of examples have been posted where the author spent quite a bit of time formatting an example, only to have the posted code totally bastardized. Have at least a <code> tag that would present the content within the tag in a fixed-width font and not remove leading spaces. I've seen some posts where the poor soul has tried 2-3 times to get their poin t across only to have the presented code rendered in a way that completely loses…
16 votes -
16 votes
-
Convert code to dynamic Code
Convert selected CODE or a complete stored procedure to Dynamic SQL Code.
16 votes -
Allow item following AND/OR to be on new line
When formatting SQL, it would be good to have the option to put the item following an AND/OR on a new line and align it, so instead of:
WHERE
OutgoingResults.LoadDateKey = 20191106
AND OutgoingResults.FeedName = 'TestFeed'we have
WHERE
OutgoingResults.LoadDateKey = 20191106
AND
OutgoingResults.FeedName = 'TestFeed'14 votes -
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 -
Indent statement after IF when not enclosed by BEGIN/END block
if blah=1
____return 1;if blah=2
_begin
_return 2;
_end
else
_return 0;13 votes
- Don't see your idea?