Formating not correct when using OVER()
Random Lengths
Posts: 43 Bronze 2
I just ran a cntrl K + Y and this is what I got
SELECT tst.TransId
,tst.TransType
,tst.Invoice
,tst.OrgId
,tst.IndId
,tst.PUB
,tst.Media
,tst.TransDate
,tst.Amount
,tst.GST
,tst.Reconciled
,tst.Void
,SUM(tst.Amount) OVER () AS MTotal
,SUM(tst.GST) OVER () AS GSTTotal
FROM [subscriptions].[dbo].[tblSubsTrans]
AS tst
WHERE MONTH(tst.TransDate) = 7
AND YEAR(tst.TransDate) = 2010
AND tst.GST > 0
AND tst.Void = 0
ORDER BY tst.Invoice
,tst.IndId
,tst.PUB
I expected:
SELECT tst.TransId
,tst.TransType
,tst.Invoice
,tst.OrgId
,tst.IndId
,tst.PUB
,tst.Media
,tst.TransDate
,tst.Amount
,tst.GST
,tst.Reconciled
,tst.Void
,SUM(tst.Amount) OVER () AS MTotal
,SUM(tst.GST) OVER () AS GSTTotal
FROM [subscriptions].[dbo].[tblSubsTrans]
AS tst
WHERE MONTH(tst.TransDate) = 7
AND YEAR(tst.TransDate) = 2010
AND tst.GST > 0
AND tst.Void = 0
ORDER BY tst.Invoice
,tst.IndId
,tst.PUB
If I remove the two SUM fields, I get the expected indentation. I hope indenting shows up in this post.
SELECT tst.TransId
,tst.TransType
,tst.Invoice
,tst.OrgId
,tst.IndId
,tst.PUB
,tst.Media
,tst.TransDate
,tst.Amount
,tst.GST
,tst.Reconciled
,tst.Void
,SUM(tst.Amount) OVER () AS MTotal
,SUM(tst.GST) OVER () AS GSTTotal
FROM [subscriptions].[dbo].[tblSubsTrans]
AS tst
WHERE MONTH(tst.TransDate) = 7
AND YEAR(tst.TransDate) = 2010
AND tst.GST > 0
AND tst.Void = 0
ORDER BY tst.Invoice
,tst.IndId
,tst.PUB
I expected:
SELECT tst.TransId
,tst.TransType
,tst.Invoice
,tst.OrgId
,tst.IndId
,tst.PUB
,tst.Media
,tst.TransDate
,tst.Amount
,tst.GST
,tst.Reconciled
,tst.Void
,SUM(tst.Amount) OVER () AS MTotal
,SUM(tst.GST) OVER () AS GSTTotal
FROM [subscriptions].[dbo].[tblSubsTrans]
AS tst
WHERE MONTH(tst.TransDate) = 7
AND YEAR(tst.TransDate) = 2010
AND tst.GST > 0
AND tst.Void = 0
ORDER BY tst.Invoice
,tst.IndId
,tst.PUB
If I remove the two SUM fields, I get the expected indentation. I hope indenting shows up in this post.
Comments
As per your post and your email I think you are using SQL Prompt 4.0.4.11
Can you kindly install the latest patch version of SQL Prompt from here?
Kindly let me know if this fixes the issue.
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
No change in behavior.
The issue is not resolved.
Dan