Expand * in pivot query

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
sebeto
Posts: 9
Joined: Tue 22 Apr 2014 03:19

Expand * in pivot query

Post by sebeto » Tue 22 Apr 2014 03:36

Hi,

New user of SQLComplete, I'm testing it before trying to push it to my colleagues if it suits our needs (some of them currently using SQLPrompt).

Our data model requires a lot of pivoting, for example in the following query:

Code: Select all

select *
from
(
	select	c.SAMPLEID
			,c.NAME
			,c.VALUE
	from CORPSAMPLEASSAY as c
	where c.NAME in ('LOI_Total', 'MnO_Calc_pct', 'Tot_Chk')
) as t
pivot
(
	avg(VALUE)
	for NAME in (LOI_Total, MnO_Calc_pct, Tot_Chk)
) as pvt
Am I doing something wrong, or can't '*' be expanded properly in this kind of situation?

If I TAB after *, SQLComplete expands to what follows rather than the pivoted columns:

Code: Select all

select t.SAMPLEID,t.NAME,t.VALUE
It should be:

Code: Select all

select 	pvt.SAMPLEID, pvt.LOI_Total, pvt.MnO_Calc_pct, pvt.Tot_Chk
It's quite an issue as it renders the expanding useless as soon as I have pivots in my CTEs and so on.

Is there any plan to implement expanding for pivoted fields in a near future?

alexa

Re: Expand * in pivot query

Post by alexa » Tue 22 Apr 2014 09:59

This appears to be a new feature that we are planning to implement in one of the next versions of the product.

sebeto
Posts: 9
Joined: Tue 22 Apr 2014 03:19

Re: Expand * in pivot query

Post by sebeto » Wed 23 Apr 2014 05:57

Great, thanks a lot for your reply Alexa, I'm looking forward to having this ability!

alexa

Re: Expand * in pivot query

Post by alexa » Mon 24 Apr 2017 16:24

We would like to let you know that we have released dbForge SQL Complete, v5.6 where the functionality you were referring to is supported https://www.devart.com/dbforge/sql/sqlc ... nload.html

Thank you for your help in improving dbForge SQL Complete.

Post Reply