| Author |
Message |
Andras
Joined: 19 May 2005 Posts: 249 Location: Cambridge, UK
|
Posted: Mon Dec 11, 2006 1:02 pm Post subject: Re: |
|
|
| vudang wrote: |
I'm not sure if this is available as an option but I cannot get sql refactor to format the insert column list on one line when using insert select. Basically the following is not possible.
INSERT INTO #extract_tlot
(
entity_name, id_1,id_2,id_3
)
SELECT DISTINCT
tl.entity_name,tl.id_1,tl.id_2,tl.id_3
FROM sometable |
Hi,
this one is actually a bug, and this will be fixed in version 1.1. I will also contact you concerning this in a private message. Many thanks,
Andras _________________ András Belokosztolszki, PhD
Red Gate Software Ltd. |
|
| Back to top |
|
 |
obbyyoyo
Joined: 14 Feb 2007 Posts: 2
|
Posted: Wed Feb 14, 2007 7:47 pm Post subject: Trailing Spaces |
|
|
This is a nice-to-have kind of thing that would comfort the compulsive side of me.
I would like to always have trailing spaces removed, or at least have it as an option.
simplistic example:
before:
| Code: |
IF 1 = 1 BEGIN SELECT t.* FROM dbo.Foo WHERE t.bar = 'zee' END ELSE BEGIN SELECT t.* FROM dbo.Zee WHERE t.bar = 'foo' END |
after:
| Code: |
IF 1 = 1 -- <-- there is a trailing space here
BEGIN
SELECT
t.*
FROM
dbo.Foo
WHERE
t.bar = 'zee'
END
ELSE -- <-- there is a trailing space here
BEGIN
SELECT
t.*
FROM
dbo.Zee
WHERE
t.bar = 'foo'
END
|
|
|
| Back to top |
|
 |
Lamprey
Joined: 22 Feb 2007 Posts: 3
|
Posted: Thu Feb 22, 2007 9:46 pm Post subject: Blocks |
|
|
I know there are many ways to indent/format blocks of SQL. Specifically, the BEGIN-END blocks. I noticed someone liked the BEGIN at the end of the previous statement like:
That aside, I would like to see an option whether or not to indent (Assuming I did not miss this feature). So, the option would work like this:
Option 1 (No Indent)
| Code: |
BEGIN
SELECT
*
FROM
foo
END |
Option 2 (With Indent)
| Code: |
BEGIN
SELECT
*
FROM
foo
END |
Cheers! |
|
| Back to top |
|
 |
Lamprey
Joined: 22 Feb 2007 Posts: 3
|
Posted: Thu Feb 22, 2007 10:05 pm Post subject: Expression issue |
|
|
One other thing I noticed is a potential problem formatting expressions that contain operators. I have my option set to place a space around operators so that things are spaced out a bit. Because of this setting it changes a statement like:
| Code: |
| RAISERROR ('Error', -1, -1) |
to one with spaces after the operator:
| Code: |
| RAISERROR ('Error', - 1, - 1) |
I realize it is only whitespace, but I thought I'd mention it. |
|
| Back to top |
|
 |
SvdSinner
Joined: 27 Feb 2007 Posts: 11 Location: North of my cattle barn, Ames, IA
|
Posted: Tue Feb 27, 2007 4:26 pm Post subject: |
|
|
I prefer to indent everything except for the initial line of a statement so that it is clear where statements begin/end. Examples:
| Code: |
SELECT *
FROM table
WHERE col1 = whatever |
Of course that example is fairly trivial, but it really gets useful in cases like this:
| Code: |
INSERT table
(col1, col2, col3)
SELECT column1, column2, column3
FROM table2
WHERE condition = true |
Much easier to read, IMHO. The standard form (aligning all clauses) leaves you wondering if SELECT statements are standalone or part of a larger query. This makes is simpler to determine at a glance what belongs to what. |
|
| Back to top |
|
 |
mbuis
Joined: 20 Nov 2006 Posts: 3
|
Posted: Thu Apr 12, 2007 2:23 pm Post subject: Indent body of transaction |
|
|
I would like the option to indent the body of a transaction:
| Code: |
SELECT ...
BEGIN TRAN
UPDATE ...
UPDATE ...
IF (@@ERROR = 0)
COMMIT
ELSE
ROLLBACK
SELECT ...
|
BEGIN TRAN would increase the indent level. Knowing when to decreasing it would be a but tricky to determine, as there may be conditional logic involved. |
|
| Back to top |
|
 |
aaronkool29
Joined: 12 Mar 2007 Posts: 2
|
Posted: Thu Apr 12, 2007 2:30 pm Post subject: Location of Variable Type Definitions & Select Statement |
|
|
Changed to the Following *(Note the Periods are just for Formatting on this post, those would appear as spaces in SQL)
DECLARE
@lProcedureName .VARCHAR(100),
@lReturnCode .......INTEGER
@lValue .................INTEGER
SELECT
@lProcedureName. = 'TestProcedure,
@lReturnCode....... = 0,
@lValue................. = 123 |
|
| Back to top |
|
 |
ad2000
Joined: 13 Apr 2007 Posts: 1
|
Posted: Fri Apr 13, 2007 10:30 am Post subject: Case sensitivity and squared brackets |
|
|
Hello!
I am testing SQL Refactor and I suggest two more features:
1. I would prefer that the object names and column names would be formatted with case sensitivity.
2. And I would like to have the squared brackets set automatically to object and column names like SELECT [EmployeeID], [Title], [NationalIDNumber] FROM [HumanResources].[Employee];
Thank you! |
|
| Back to top |
|
 |
Bodhi
Joined: 22 Nov 2006 Posts: 6 Location: Spokane, Washington
|
Posted: Fri Apr 13, 2007 4:21 pm Post subject: Formatting object names with case sensitivity |
|
|
| The run time performance is better when the object names are qualified by the schema name AND the object name case is correct. So, formatting with case correction would be a valuable feature. |
|
| Back to top |
|
 |
GaryJF
Joined: 17 May 2007 Posts: 5 Location: N. Ireland
|
Posted: Sun May 20, 2007 2:38 am Post subject: Layout as per Microsoft Help Files |
|
|
As a consultant, I have been to many different companies and I have noticed that quite a few of them use the defacto Microsoft layout, i.e. the layout you find in the help files.
You cannot achieve this layout with the current version of Refactor, which is a shame. Although, this is unsurprising considering the many layouts being utilised in the industry, I can see a much wider audience making use of it if it was able to layout the code in the same format as the help files.
Probably the most imortant changes to assist in this would be:
1. The ability to align comments with the next line of code
2. The ability to have BEGIN END blocks align directly under the keyword it serves
3. The ability to list colums horizontally in SELECT statements, yet vertically in modification statements (UPDATE and INSERT)
4. The ability to decide which keyword types should be uppercased (for example, uppercase all except datatypes)
There are a few others, which can easily be spotted by copying SQL Server example code and laying it out to see the changes.
If Refactor ever becomes as flexible as SQL Prompt, then it would be an invaluable asset in laying out the code. As for now, I use refactor solely for its other features, like Smart Rename, Script Summary etc. I have just purchased both the SQL Compare Bundle and the SQL Prompt Bundle, so I am a big fan of Red-Gate tools...but I know I could encourage many more of my clients to invest in the SQL Prompt Bundle when the layout feature matches the flexibility of Prompt! _________________ The client doesn't know what he wants, until he doesn't get it! |
|
| Back to top |
|
 |
Wyatt70
Joined: 29 Jul 2005 Posts: 36 Location: Yonkers, NY
|
Posted: Thu May 24, 2007 6:43 pm Post subject: Hanging Indent |
|
|
Why do the statements following FROM, JOIN, ON use a "hanging indent"?
For example:
| Code: |
FROM
[TableName] AS [TableNameAlias]
INNER JOIN [TableName1] AS T1
ON
T1.TableID = T2.TableID
INNER JOIN [TableName2] AS T2
ON
T2.Column = T1.Column;
|
I would like to be able to display it this way:
| Code: |
FROM [TableName] AS [TableNameAlias]
INNER JOIN [TableName1] AS T1
ON T1.TableID = T2.TableID
INNER JOIN [TableName2] AS T2
ON T2.Column = T1.Column;
|
|
|
| Back to top |
|
 |
rx400h
Joined: 24 May 2007 Posts: 2
|
Posted: Thu May 24, 2007 9:28 pm Post subject: exec sp layout |
|
|
is this possible to layout like this
exec dbo.spS
@xdoc=@xdoc
, @xmldata = @xmldata
Currently it is laying out like this
exec dbo.spS @xdoc=@xdoc, @xmldata = @xmldata _________________ R K |
|
| Back to top |
|
 |
Giggles220
Joined: 07 Dec 2006 Posts: 114 Location: Albany, NY
|
Posted: Fri May 25, 2007 5:30 pm Post subject: |
|
|
Out of the listed suggestions I'd like to see the following:
- Spaces before keywords
- Nested Joins to show join order
- align commas with columns
- indent line comments with next or previous line
- remove trailing spaces
- object name and column name formated with case sensitivity
- Ability to select upper or lower case for certain objects (for example I like my commands to be in upper case but my objects maybe to be lower case) |
|
| Back to top |
|
 |
martin.kelly@primacycorp. Guest
|
Posted: Sat May 26, 2007 7:02 am Post subject: JOIN layout / Tabs |
|
|
oops
Last edited by martin.kelly@primacycorp. on Sat May 26, 2007 7:13 am; edited 1 time in total |
|
| Back to top |
|
 |
Viking Geek
Joined: 26 May 2007 Posts: 1
|
Posted: Sat May 26, 2007 7:11 am Post subject: JOIN layout and tabs vs spaces |
|
|
Rather than:
| Code: |
SELECT
*
FROM
HumanResources.Employee AS e
INNER JOIN Person.Contact AS c ON e.ContactID = c.ContactID
WHERE
c.ContactID = 25
ORDER BY
c.LastName |
I would prefer to have the joined table and condition on a new line, like this:
| Code: |
SELECT
*
FROM
HumanResources.Employee AS e
INNER JOIN
Person.Contact AS c ON e.ContactID = c.ContactID
WHERE
c.ContactID = 25
ORDER BY
c.LastName |
I think that is more consistent with the layout, as major keywords are alone on each line.
I would also prefer to use tabs over spaces for indents. |
|
| Back to top |
|
 |
|