184 results found
-
Multiple format options for insert statements
Currently SQL Prompt only has one option for formatting insert statements which poses a problem for us with multi value set inserts.
Ideally we'd be able to select a formatting for a single value set insert and another format for a multi value set insert.
This would allow us to do something like this:
-- Single Value Set Insert
INSERT INTO TestTable (TestName,
~~~~TestValue,
~~~~TestDate)
VALUES (N'Something',
~~~~140,
~~~~'1/1/2019')-- Multi Value Set Insert
INSERT INTO TestTable (TestName, TestValue, TestDate)
VALUES (N'Something', 140, '1/1/1900'),
~~~~(N'SomethingElse', 150, '1/2/1900'),
~~~~(N'SomethingElse2', 160, '1/2/2000')The issue for us is that we have need of…
10 votes -
Option For Aliases (Only For Custon Alias)
Hi
it is better to SQL prompt use only aliases define with user.need option in Aliases : Only For Custom Aliases
Sorry For My Bad English
3 votes -
flip between adding and removing square brackets
Add ability to add or remove square brackets without having to edit the settings for which direction you want it to go.
4 votes -
Alias on Synonym Name
Have auto alias base its output on the alias name instead of the name of the table it is pointing to.
Example: Alias "Transaction" pointing to "TransactionTableWithComplexName" should be "t" and not "ttwcn".
1 vote -
Automatically add DROP TABLE IF EXISTS for #temp tables
It would be nice if SQL Prompt had a way to add in the code DROP TABLE IF EXISTS #table for temp tables. Ideally it would add the statement immediately before the table is created from a CREATE TABLE or SELECT INTO statement.
11 votes -
Add one additional Parenthesis style
My Teams would prefer this option:
xxxxxxxxxxxxxx (
xxxxxxx,
xxxxxxx )Opening parenthesis on the first line, and closing parenthesis on the last line.
Second and following lines indented one stop. This display seems to strip out the leading spaces.
4 votes -
Parentheses
New Parentheses Style - #6 but ends like #1
Numbering starting at the top left as #1 and continuing to the right one as #5. With the next line starting as #6 and finishing on the right of line 2 as #9.
In the global parentheses settings, Lets make a #10 option which works like #6 in all ways except the closing parentheses is aligned with the beginning parentheses like it does on #1. Actually looking at the graphic that shows on #1, this looks like what I want, the trailing parentheses is below the first one, but #1 has…1 vote -
Add space between closing parethesis of a function call and FROM
Add an option to add a space between a function call, such as COUNT(), and FROM so that we don't end up with code like SELECT COUNT()FROM table. That doesn't happen when I select "Add spaces around parentheses" in the global parentheses options. The only way I've been able to get SQL Prompt to preserve that space is to select "Add spaces around parentheses" in the Function calls options, but I don't want a space between the function name and opening parenthesis.
4 votes -
conditions new line after
Currently we have a standard of placing new line before and after conditions with indent accordingly such that:
a=1
AND
b=2Current version only does:
a=1
AND b=2This is pretty much the only thing lacking from being able to just auto format all our procedures with a single click.
4 votes -
Provide support for "Suffixes to ignore" in "Insert code > Aliasing" options
We use a data warehousing strategy that creates potentially dozens of tables for multi-class entities in the data warehouse, so we have many tables that end in "core". This leads SQL Prompt to alias the object with a final "C" that we then remove manually. For example, our InstanceCore and Database_Core tables are aliased to "IC" and "DC" when we would prefer "I" and "D" respectively.
Can SQL Prompt's Aliasing capabilities be extended to support "Suffixes to ignore" just like the existing "Prefixes to ignore"?
1 vote -
Ignore Begin statements with CTE immediately after
SQL Prompt's "Insert semicolon" function behaves weirdly when a CTE is a the start of a control loop. For example, if I have this code:
IF (1=1) BEGIN
WITH numbers AS (
SELECT 1 AS num
UNION SELECT 2
UNION SELECT 3
UNION SELECT 4
)
SELECT * FROM numbers
END;SQL Prompt will format it as
IF (1=1) BEGIN;
WITH numbers AS (
SELECT 1 AS num
UNION SELECT 2
UNION SELECT 3
UNION SELECT 4
)
SELECT * FROM numbers;
END;While the code runs, I think the semicolon after "BEGIN" makes very little sense. First, the beginning…
3 votes -
Shortcut to move commas from start to end and vice versa.
I would like to only affect the placement of commas in a column list, without applying other formatting options. This would work similar to Ctrl-B, Ctrl-B to remove brackets or Ctrl-B, C to insert semicolons, in that no other formatting would take place.
There are times I have a rather well-formatted script but it has been written with commas at the start of the line and I prefer them at the end. A new shortcut would toggle placing commas at the start or end of the line without affecting other formatting within the script.
5 votes -
Additional Formatting Options
These are the typical formatting styles I use that I would like to see definable in SQL Prompt. Currently, I use a style that gets me close then manually format the remainder to the code:
Regarding the desired format of
1) SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY all lined up
2) TAB after SELECT, followed by first 'column'
3) Subsequent columns on separate lines and lined up with the first one.
4) TAB after any CASE followed by first WHEN
5) Subsequent WHENs lined up with first one
6) TAB before THEN (i.e. indented one tab from…4 votes -
Add option to wrap lines when concatenating strings
Sometimes I set a variable equal to many strings concatenated together using the "+" syntax. When I format with Regdate, there is no option to wrap lines in this case. Everything ends up on the same line as the SET, so the lines often get very wide and go off screen.
It would be great if there was an option to wrap text if things got too wide horizontally.
One solution would be a setting to format concatenated strings like this:
SET @Variable = N'String1'
+ N'String2'
+ N'String3'4 votesHi Amanda,
Would the ‘wrap lines longer than X characters’ option in the formatting styles help with this?
Tim
-
Top with parenthesis should be a formatting option
Changing
SELECT TOP 10...
to
SELECT TOP (10)... should be a formatting option.
11 votes -
Make parentheses rules customizable (where what applies) instead of a global setting
I have different wants for parentheses rules: Collapse short content or not, Having Parentheses on separat lines or leading the content, etc. It all depends on the context. But currently the setting is global.
I would like to be able to define one rule for, say, Primary Key definitions, and another rule for, say, the columns of a table.
I would want one thing for Control Flow sections, and another thing for Variables declarations.Today, I need to choose which one to be dominant (or stop using FORMAT SQL on the entire script, but just highlight the block where I…
3 votes -
format Window functions
SQL Prompt fails badly in formatting window functions. As these are present at least since SQL 2014, SQL Prompt should be able to interpret them and format them accordingly.
Example:
I would format the LAG() function as follows:
SELECT
myColumn AS realColumn
,LAG(myColumn, 1, 0)
OVER (
PARTITION BY someColumn
ORDER BY anotherColumn) AS calculatedColumnTry this with SQL Prompt - it's result is not very nice...
5 votes -
Custom values for VALUES clause
I write a LOT of unit tests, usually at the rate of 15:1 to 20:1 to my executing code. I have these standardized and templated to make them easier and more consistent to build. e.g. @GUID UNIQUEIDENTIFIER = NEWID(),
@Char CHAR(1) = 'A',
@Int INT = 1,
@Datetime DATETIME = CURRENTTIMESTAMP,
@Decimal DECIMAL(18,10) = 1.0,
@Date DATE = CURRENTTIMESTAMP,
@Time TIME = CURRENT_TIMESTAMP,
@Bit BIT = 1,
@Money MONEY = 1.00,
@Binary VARBINARY(18) = 0x01,These go into my VALUES clause for INSERT statements, but I current have to do all of this manually, which takes a LOT…
2 votes -
"Remove Square Brackets" option
The "Remove Square Brackets" option does not work for "CREATE EXTERNAL TABLE" statement.
Please try this option with the example below and nothing happens.
CREATE EXTERNAL TABLE [ft].[Account]
(
[AccountId] [bigint] NOT NULL,
[AccountType] [nvarchar] (50) COLLATE NOT NULL,
[AccountCreatedDate] [datetime2] NOT NULL
)
WITH
(
DATASOURCE = FinancialDB,
SCHEMANAME = 'Account',
OBJECT_NAME = 'Account'
);2 votes -
THEN expression on same line as keyword
Current formatting is:
CASE
WHEN 1 = 1 THEN
'Hello World'
ENDI need the option to put the expression on the same line:
CASE
WHEN 1 = 1 THEN 'Hello World'
END12 votes
- Don't see your idea?