Hmm..... SQL Prompt is trying to be helpful by adding table aliases - but again, it's not very smart discovering that one alias might already be in use....

I started with this query:

select * from [dbo].[T_Contract] AS tc

and then added

inner join [dbo].[T_Checklist]

and SQL Prompt added "as tc" for the alias. Sorry, that alias is already taken!

Also, since all our tables are prefixed with a "T_", SQL Prompt tends to suggest awfully similar table aliases over and over. It would be nice to be able to specify the algorithm how to suggest the table alias - e.g. let me tell SQL Prompt to ignore the first x characters of a table name, or even better, let me define a list of table aliases for a given database and store that; if I specified a table alias myself, use that, and only resort to "guessing" a table alias if you don't have a specific assignment by me.
mscheuner
0

Comments

7 comments

  • Bart Read
    Thanks Marc,


    You're right: that isn't terribly clever. Fortunately it's also quite easy to fix. Again, just something we missed in order to get the beta out.

    I guess in order to allow you to tune the alias generation we could add lists that would cause SQL Prompt to ignore user-defined prefixes or suffixes when generating aliases.

    So for example you could set it up in the options dialog to ignore prefixes such as "T_", "V_" etc.

    Would this do the trick? If so we'll try to get something in for the final release.


    Thanks,
    Bart
    Bart Read
    0
  • mscheuner
    Bart Read wrote:
    So for example you could set it up in the options dialog to ignore prefixes such as "T_", "V_" etc.

    Would this do the trick?
    Yes, that would definitely be an option - specify some prefixes to ignore, or a number of chars to ignore.

    Even better would be a way to specify manually, on a table-by-table (and view-by-view) basis, what prefixes to use. Fill those in with your best guess, but allow me to change them where appropriate and needed.

    Thanks!
    Marc
    mscheuner
    0
  • nanchen
    While it would be nice to specify alias on a per table/view basis, this is not yet sufficient: suppose that I want to join a table with itself. Then I would expect the tool to provide me with two different alias names (like myalias and myalias2, for instance...)

    Just my 2 cents,

    Emmanuel
    nanchen
    0
  • mscheuner
    nanchen wrote:
    While it would be nice to specify alias on a per table/view basis, this is not yet sufficient: suppose that I want to join a table with itself. Then I would expect the tool to provide me with two different alias names (like myalias and myalias2, for instance...)
    Good point, yes. That would be required "smarts" for SQL Prompt 3, too! :-)

    Marc
    mscheuner
    0
  • Bart Read
    Hmm... self-joins. Interesting. :shock:
    Bart Read
    0
  • mscheuner
    Hmm... self-joins. Interesting

    You *do* like a good challenge, don't you? :lol:

    Marc
    mscheuner
    0
  • Bart Read
    8)
    Bart Read
    0

Add comment

Please sign in to leave a comment.