"Format SQL" feature removing aliases! Why??!
kmh090
Posts: 3
Ok, I think this recently started happening and maybe it was part of a recent release (not sure when I upgraded last - I'm on 7.0.0.52). Either way, I don't like it and I want this feature to go away! If I write a query with aliased columns and hit ctrl k + y, My nice query:
becomes this (notice all my aliases are gone)....
Now I know SQL prompt keeps the aliases if there is a conflict (i.e the same column name exists in the query more than once, o.OfficeID = c.OfficeID), however that does not help me here. The second query makes my brain hurt, I need my aliases. I looked to an option to turn it off but couldn't find one. please help!!
Signed,
Frustrated control-freak SQL guy
SELECT sd.ServiceDataID, StatusName = l.LookupValue FROM svc.ServiceData sd INNER JOIN Lookups l ON sd.StatusID = l.LookupID
becomes this (notice all my aliases are gone)....
SELECT ServiceDataID, StatusName = LookupValue FROM svc.ServiceData sd INNER JOIN Lookups l ON StatusID = LookupID
Now I know SQL prompt keeps the aliases if there is a conflict (i.e the same column name exists in the query more than once, o.OfficeID = c.OfficeID), however that does not help me here. The second query makes my brain hurt, I need my aliases. I looked to an option to turn it off but couldn't find one. please help!!
Signed,
Frustrated control-freak SQL guy
Comments
"Go to SQL Prompt -> Options -> Qualification and make sure that the "qualify object names with aliases" option is checked."
I was looking in the 'format' section only (not 'qualification'), there's an option to qualify object names in there too which I thought that was the correct setting. thanks guys!
Thanks for posting and sorry for the frustration!
For anyone else who reads this, we solved it by going to SQL Prompt -> Options -> Qualification and making sure that the "qualify object names with aliases" option is checked.
It was a pleasure working with you and hope you have a great New Years!
Warmly,
Technical Sales Engineer
Redgate Software