80 results found
-
Format selected code
Formatting a section (selected code block) with CTRL+K, CTRL+Y). This would allow me to highlight a section of a proc and format it to my liking and leave the (abomination) of the proc body untouched.
3 votes -
XML Data Type method layout SQL support
Can not use SQL prompt to layout XML data type functions, for example this statement:
SELECT(SELECT 1 Col
FOR XML PATH(''), TYPE).value('.', 'VARCHAR(MAX)')3 votes -
support for new SQL Function DATE_BUCKET
Please add support for new SQL Functions such as DATE_BUCKET
https://learn.microsoft.com/en-us/sql/t-sql/functions/date-bucket-transact-sql?view=sql-server-ver16Currently it get quoted which is quite inconvenient.
declare @date datetime2 = '2020-04-30 21:21:21' Select 'Week', DATE_BUCKET(WEEK, 1, @date) Union All Select 'Day', DATE_BUCKET(DAY, 1, @date) Union All Select 'Hour', DATE_BUCKET(HOUR, 1, @date) Union All Select 'Minutes', DATE_BUCKET(MINUTE, 1, @date) Union All Select 'Seconds', DATE_BUCKET(SECOND, 1, @date);
becomes
…DECLARE @date DATETIME2 = '2020-04-30 21:21:21'; SELECT 'Week', [DATE_BUCKET] ( [WEEK], 1, @date ) UNION ALL SELECT 'Day', [DATE_BUCKET] ( [DAY], 1, @date ) UNION ALL SELECT 'Hour', [DATE_BUCKET] ( [HOUR], 1, @date ) UNION ALL SELECT 'Minutes', [DATE_BUCKET] ( [MINUTE],
2 votesSupport for DATE_BUCKET shipped in SQL Prompt 10.13.9 https://documentation.red-gate.com/sp/release-notes-and-other-versions/sql-prompt-10-13-release-notes
-
Add formatting for CREATE EXTERNAL TABLE syntax
CREATE EXTERNAL TABLE and CREATE EXTERNAL DATA SOURCE syntax is not formatted nicely by SQL Prompt, it just puts the statements on one line.
I've been told the developers are not going to take this on!!!!
2 votesSupport shipped in 10.13.9 https://documentation.red-gate.com/sp/release-notes-and-other-versions/sql-prompt-10-13-release-notes
-
Put single quote marks around highlighted text (including multiple lines)
Very often i have copied a list of items i want to query in an IN() statement from the database, for example:
abc
def
ghi
jkland I want to format it like this:
'abc'
'def'
'ghi'
'jkl'or better yet:
'abc'
, 'def'
, 'ghi'
, 'jkl'Being able to highlight, right click, and select an option do do this, would be incredibly helpful.
2 votes -
SQL Formatter error
When using OPENJSON with the WITH clause, the formatter does not recognize the WITH clause as valid SQL. This should format but throws an error:
DECLARE @JSONString NVARCHAR(MAX) SET @JSONString = N'{"Vendors":[{"VendorNumber":200,"VendorName":"Vendor1"},{"VendorNumber":201,"Vendo2"},{"VendorNumber":202,"VendorName":"Vendor3"}]}'
SELECT VendorNumber ,
VendorName
FROM OPENJSON(@JSONString, '$.Vendors')
WITH (VendorNumber INT '$.VendorNumber', VendorName VARCHAR(50) '$.VendorName')2 votesThis formatted error has been fixed in the latest version SQL Prompt 8:
https://forum.red-gate.com/discussion/80988/latest-stable-build-of-sql-prompt-is-8-0-0-1241-11th-may#latestThanks for your suggestion!
-
Exclude a region from formatting
Sometimes, formatting makes a query less readable, e.g.
insert table (col1, col2, col3, ....)
values (1,2,3,...),
(11,12,13,...),
...Formatting will put the values on multiple lines if there are enough of them. It's easier to see the data when they are on one line. So how about:
--#region [optional description] #SQLPromptIgnore
--anything in here doesn't get formatted
--#endregion [optional description]Not sure what would be best for '#SQLPromptIgnore'
2 votesAs Joe Momberg said, this is now available in 7.3 – http://documentation.red-gate.com/display/SP7/SQL+Prompt+7.3+release+notes#SQLPrompt7.3releasenotes-Disableformattingforblocksofcode
You can download the latest version of SQL Prompt from http://www.red-gate.com/products/sql-development/sql-prompt/
-
One line SQL from context menu - Opposite if Format SQL
Have a function which is the opposite to 'Format SQL' so you can select a section of text and have all the Line Breaks and padding taken out. Currently I use HTML Shrinker Pro to do this, but it would be nice to select a block and one line it eg..
@DateAppointed = CASE WHEN LEN(DateAppointed)> 1 THEN DateAppointed ELSE @Unknown END ,2 votesSQL Prompt 7 has an “Unformat” action in the new Actions list. The full release notes can be found here http://documentation.red-gate.com/display/SP7/SQL+Prompt+7.0+release+notes
-
Format SQL so keywords are right aligned
SELECT Number1
,Number2
,Number3
FROM table r
JOIN table2 tf
ON r.column = tf.column
AND r.column = 0
WHERE column = 0
AND column1 = 22 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 -
Formatting of AT TIME ZONE
In SQL Server 2016 it is now possible to calculate between timezones. Currently it gives me an error, when I want to format it. The syntax is also not allowed at the moment.
1 voteAT TIME ZONE is now supported in SQL Prompt 7.4
You can download the latest version of SQL Prompt from http://www.red-gate.com/products/sql-development/sql-prompt/
-
create or alter
SQL server 2016 SP1 introduced the "CREATE OR ALTER" PROCEDURE/VIEW - syntax, which would be very nice to have support for.
1 voteThis feature was released in version 7.3 of SQL Prompt.
If there are any missing features please let us know by creating a new suggestion.
Kind Regards,
The Prompt Team -
Formatting of Valid Selected code when there is invalid code in the script
I used to be able to format selected code, as long as it was valid. Now when I select code that is valid in a larger script that has invalid code it does not format the selected code at all. If the invalid code immediately precedes it it will suggest that there is an error in the first character of my selection when there is none, else it will just act like it did something but do nothing. This used to work and is a frustration now. This has been the case with both 7.3 betas and I believe at…
1 vote -
format is now deleting extra lines after the query
Looks like version 7.3 of SQLPrompt removes all blank lines after the query that it formats. Please change this back or make it optional to delete blank lines at the bottom of the query.
1 voteWe’ve just shipped a new beta build (7.3.0.619) that will preserve the extra lines at the end of the query if “Preserve existing new lines between statements” is checked.
You can download the latest beta build from https://forums.red-gate.com/viewtopic.php?f=169&t=79994
-
Stop aliasing scientific notation
SQLPrompt will take scientific notation, and alias it as 1[e1], 1[e2] and so on.
1e1
1e2
1e3
1e4
1e5
1e6
1e7
1e8
1e91 voteHi Erik,
Thanks for letting us know about this issue. It should now be fixed in the latest build of SQL Prompt (7.1.0.314)
-
Don't indent BEGIN/END bloc after AS in function/procedure definition
CREATE FUNCTION MyFunc()
RETURNS INT
AS
BEGIN
----IF 1=1
--------BEGIN
------------<some code>
--------END
END
END1 voteThis should already be an option in SQL Prompt under Format→Schema statements→Indent contents.
-
Aggregate Functions wrongly put in square brackets
I think I 've found a bug...
If you Format this SQLDECLARE @Translations TABLE ( [FundTypeId] INT NOT NULL , [ColumnName] NVARCHAR(128) NULL , [ColumnValue] NVARCHAR(256) NULL , [InsertedAt] DATETIME NULL , [InsertedBy] NVARCHAR(256) NULL , [LastUpdatedAt] DATETIME NULL , [LastUpdatedBy] NVARCHAR(256) NULL , PRIMARY KEY ( [FundTypeId] ) ); SELECT * FROM ( SELECT [pt].[FundTypeId] , [pt].[FundType] , [pt].[Comment] , [pt].[InsertedAt] , [pt].[InsertedBy] , [pt].[LastUpdatedAt] , [pt].[LastUpdatedBy] FROM @Translations AS [tmp] PIVOT ( MAX([ColumnValue]) FOR [tmp].[ColumnName] IN ( [FundType], [Comment] ) ) AS [pt] ) AS [tmp];
... it will break the code as the MAX function of…
1 voteWe’ve just released a new build of Prompt ( 6.5.0.332) which should have a fix for this. You can get the latest version from our website http://www.red-gate.com/products/sql-development/sql-prompt/
-
RECEIVE statement - Format SQL ignores
;
RECEIVE TOP(1)
@h = conversationhandle,
@t = messagetypename,
@b = messagebody
FROM SimpleQueueTargetFrom the Service Broker Workbench on Simple Talk.
It only moves the semicolon to a separate line. No errors. Ignores "comma at start".
And, yes, the @'s above probably start in column 1, when they're actually in col 5.
1 voteThis 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 -
Format "case" keyword also in uppercase
When formatting a case statement I want the case keyword to show in uppercase just like the when and end keywords. Now initially it uppercases CASE but when running SQL format it turns it to lowercase (bug?) See example below of the current format behaviour.
SELECT case WHEN 1 = 1 THEN 1
ELSE 0
END1 voteThis should be fixed in the latest build of Prompt
-
Incorrect capitalization of system functions
The SQL Prompt formatter incorrectly tries to capitalize (whether automatically while I type or using the formatter) system functions that are missing a database prefix. For example, SQL Prompt doesn't try to capitalize:
sys.fn_listextendedproperty
but it WILL capitalize
fn_listextendedproperty
as soon as I hit space, regardless of the CASE setting in SQL Prompt's options. Obvious, a capitalized FN_LISTEXTENDEDPROPERTY does not work: the function is case-sensitive.
There does not appear to be a way around this, not even by setting Format -> Styles -> Case -> Buit-in functions to "Leave as is". That only resolves the problem for the manual formatter:…
1 voteThis is fixed in the latest build of Prompt, if you’re still having problems please let me know.
-
Case formatting
Case formatting to allow option of capitalising initial letter only - e.g. Select, not SELECT or select.
1 voteThe latest version of Prompt has the casing option UpperCamelCase which will case SELECT as Select.
- Don't see your idea?