SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Feature: optional sort in INSERT INTO and $COLUMNS$ macro

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Feature: optional sort in INSERT INTO and $COLUMNS$ macro
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2165

Post Feature: optional sort in INSERT INTO and $COLUMNS$ macro Reply with quote
The last few days I grew tired of having to reorder columns in "INSERT INTO ... SELECT ... FROM ..." statements where the source and target had their columns in different order for an arbitrary reason (mostly negligent developers tossing new columns into tables, sometimes at the end and sometimes in the middle of the column list).

SA inserts the columns of a table into the editor after selecting it from the popup triggered by typing "INSERT INTO" but it does it in order they were created. Ordering it alphabetically would be a great help in these cases. I'm already trying to create a snippet that would replace the built in unfolding of "INSERT INTO" but replacing $COLUMNS()$ macros everywhere with a $$...$$ macro that does the same job would prove to be an impossible mission. It would be handy if there was a built-in option to have the columns sorted when using $COLUMNS()$ macro.
Tue Aug 13, 2013 4:22 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 846
Country: United States

Post Reply with quote
Out of curiosity are you implying that if a developer does not put columns in alphabetical order it's negligent?

When I find myself adding new columns to a table I'll move it near other columns of relevance (ones that might get selected with the new column).... So to me, having SQL Assistant give them in the order they are defined in the table is preferable.
Tue Aug 13, 2013 12:04 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Reply with quote
I have submitted an enhancement ticket for adding sorting options to $COLUMNS()$ macro
Tue Aug 13, 2013 1:35 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2165

Post Reply with quote
Mindflux wrote:
Out of curiosity are you implying that if a developer does not put columns in alphabetical order it's negligent?

Nay, that would be dumb, wouldn't it? :)

Mindflux wrote:

When I find myself adding new columns to a table I'll move it near other columns of relevance (ones that might get selected with the new column).... So to me, having SQL Assistant give them in the order they are defined in the table is preferable.

Though I have my own preferences (which might even be more or less the same as yours), any order is fine with me as long as it is consequently followed. Adding a column to the end of the table in a database and then adding the same column to the same table in another database (data warehouse or another company or whatever) somewhere in the middle, that's what a negligent developer does. And I haven't mentioned yet when those two columns have slightly/completely different names but absolutely the same meaning. Put a single column between dozens that way and it's a nuisance. Put another two and it becomes really annoying. Put 3-4 more to make it utter nightmare. It actually makes SA returning the columns in the order they were defined getting in the way when you have to puzzle them around. I know, sorting them alpha is a brute force workaround (it's the developers I'd rather have fixed :) ) but it works (or at least, it should, in most of the cases).

SysOp wrote:
I have submitted an enhancement ticket for adding sorting options to $COLUMNS()$ macro

Thank you very much.
Tue Aug 13, 2013 4:12 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.