186 results found
-
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 -
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 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
-
Closing parenthesis and content indention on APPLY/EXISTS not indenting
It seems that the contents and closing parenthesis of EXISTS and APPLY clauses is not being indented as I would expect. So either i'm weird....or Format SQL is doing it wrong?
I'm using (
.....this parentheses style
)What it's doing:
SELECT *
FROM tblA a
WHERE 1 = 1
.....AND EXISTS (
.....SELECT *
.....FROM tblB b
.....WHERE b.Col1 = a.Col1
..........AND b.Col2 = a.Col2
..........AND b.Col3 = a.Col3
)What I expect:
SELECT *
FROM tblA a
WHERE 1 = 1
.....AND EXISTS (
..........SELECT *
..........FROM tblB b
..........WHERE b.Col1 = a.Col1
...............AND b.Col2 = a.Col2
...............AND…3 votes -
Indent AND/OR in WHERE/GROUP BY/etc. differently than ON clause
Support request #137199: Provide an option to indent AND/OR entries in a WHERE clause to line up indented, but leave AND/OR entries directly underneath ON clauses:
SELECT
t1.col5
, t2.col6
FROM
table1 t1
INNER JOIN table2 t2
ON t1.col1 = t2.col1
AND t1.col2 = t2.col2 -- AND is directly below ON clause
WHERE
t1.col3 = 'Test'
AND t2.col4 = 5 -- AND is indented underneath WHERE2 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 -
format expressions like operator
Would it be possible to treat the 'LIKE' operator the same as '=' in the Expressions\Operators settings so they are all aligned?
select AddressID
from Person.Address
where ModifiedDate
between dateadd(month, -6, getdate())
and getdate()
and City = 'Bothell'
or left(PostalCode, 2) like 'CB%'
or PostalCode = @prefix + @suffix2 votes -
Make equals signs line up with tabs
When I type code I like to line up all the equals (=) signs using tabs so that all the code to the right of the equals sign lines up nicely on my screen. I find this really useful for improving readability when using column aliases, in joins, and in update statements.
I can't find an option in SQL Prompt to do this and it annoys me when I format my SQL and all the equals signs become ragged.2 votes -
Lists formatting for Columns and Parameters should be treated separately
The starting item in a List of Columns for a SELECT statement is fine to place on the same line as the SELECT, however, for EXEC <proc name that is probably longer> it looks odd to have the Parameters line up at the end. This should be a separate choice for EXEC Parameters. I chose the "commas before" style for most everything, but prefer the "default" layout for EXEC proc parameters.
4 votes -
Refactoring INSERT into MERGE
Refactoring INSERT into UPDATE is definitely useful, but most of us are familiar with these. The complex MERGE statement is a mess, and a clean way to generate that would be fantastic!! Especially since you can figure out the primary keys, etc..
4 votes -
Formatting arithmetic - new lines (Apex has this)
The only edge Apex has over SQL Prompt formatting, at least for my use, is being able to organize long equations. If I am using a large number of columns for an equation, I'd like to place each new column on a new line.
1 vote -
Top with parenthesis should be a formatting option
Changing
SELECT TOP 10...
to
SELECT TOP (10)... should be a formatting option.
11 votes -
Align BETWEEN with comparison operators
It's currently possible to align operations in WHERE which is great, but BETWEEN is not aligned.
Example - currently:
WHEREModifiedDate BETWEEN DATEADD(MONTH, -6, GETDATE()) AND GETDATE()
AND City__________= 'Bothell'
OR LEFT(PostalCode, 2)= 'CB'
OR PostalCode_______= @prefix + @suffixExpected:
Example - currently:
WHEREModifiedDate_BETWEEN DATEADD(MONTH, -6, GETDATE()) AND GETDATE()
AND City________= 'Bothell'
OR LEFT(PostalCode, 2)= 'CB'
OR PostalCode_______= @prefix + @suffix3 votes -
Move the Options - Styles configuration to the individual Style definition page
Options - Styles pane contains, for example, "Apply column alias style" and its drop-down. This does not belong as a universal style setting, among others.
Please move it to the "Formatting Styles" configuration dialog.
This is because many practitioners either do not know about the "alias = column" capability in T-SQL, or don't like it, or it's contrary to company standards. The ability to use this form, which IMO is more brain-friendly, ought to be on the Formatting page as it is, in fact, a significant style element.
Thanks.
4 votes -
open source sql prompt's formatting module.
open source sql prompt's formatting module.
1 vote -
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 -
Comment in /* */
Is it possible to add a hard return after the /* comment */ block so code doesn't keep formatting after the comment
Currently:
/* comment */ UPDATE User
SET Modified = CAST('2018-12-20' AS datetime)
WHERE id = 255454Suggestion
/* comment */
UPDATE USER
SET Modified = CAST('2018-12-20' AS datetime)
WHERE id = 2554545 votes -
Add Support for Microsoft Analytics Platform System
If a sql command is written with an APS specific statement (for example: "CREATE TABLE AS, or "OPTION (Label = 'Query Description')" ), then a script parsing error appears.
9 votes -
Prefixes in function parameters
SQL Prompt is removing prefixes from column names used as parameters in function-calls. For example, if you use Cross Apply to a system function:
SELECT *
FROM sys.tables AS T
CROSS APPLY sys.fnlistextendedproperty('blah','schema',schemaname(T.schemaid), 'table', T.name, null, null)
It removes "T." from schemaid and name in the parameters list. This means I have to add them back in if the column names are ambiguous. I don't see a setting for this, and have Prompt set to add prefixes to columns in the other clauses. So it'll add "T." to a column in the Select clause, and remove…4 votes -
Trim white space
Please add an option be added to SQL Prompt to trim all white space.
Ideally, the following would be supported:
- Ability to execute against a query window or block of selected code
- Available as a stand-alone shortcut
- Can include as part of a Format SQL style
- Option to remove a) leading spaces, b) trailing spaces, c) both8 votes
- Don't see your idea?