Bug causes snippet insertion after auto-creation of alias.

sdelmoresdelmore Posts: 11
Super simple case here....
Type

select * from databases (enter space)

which results in automatically adding an alias giving you

select * from databases as d

then press enter to start your next line, say a join statement and have this happen

select * from databases as DELETE


I don't even have enter as an autocomplete key for my own snippets, for example if I type ij then press tab it will replace ij with INNER JOIN but if I press enter it just leaves it as ij, yet if I wrote

select * from IllogicalJargon it would create an alias named ij for me, then when I pressed enter it would replace ij with INNER JOIN.

Comments

  • PDinCAPDinCA Posts: 642 Silver 1
    Folks are adding to a User Voice thread here: http://redgate.uservoice.com/forums/94413-sql-prompt-feature-suggestions/suggestions/2476473-don-t-create-alias-that-map-to-other-sql-prompt-sh?ref=title

    Suggest anyone experiencing this BUG adds their vote to the pile so we all get a swift resolution to it... Nearly a year since this original post and it doesn't appear to be important enough to fix (maybe I'm wrong - sure hope so...)

    I assigned the alias crt to my CacheRefreshTrigger table in the SQL Prompt list of aliases, so it should know that I don't want a declared alias expanded!

    Typed
          AND NOT EXISTS ( SELECT 1
                             FROM dbo.CacheRefreshTrigger crt
    
    Resulting
          AND NOT EXISTS ( SELECT 1
                             FROM dbo.CacheRefreshTrigger CREATE TABLE 
                                                          (
                                                              
                                                          )
    
    Bad!
    Jesus Christ: Lunatic, liar or Lord?
    Decide wisely...
  • Do you have SSMS Tools Pack installed as well? This has a SQL Snippets option, which by default has "D" as a snippet for DELETE, "CRT" for CREATE TABLE, and Enter as the snippet insertion key.

    If this is the case then you can disable SSMS Tools Pack's snippets at SSMS Tools > SQL Snippets > Options....

    Regards,
    Paul
    Paul Stephenson
    Project Manager, Red Gate
Sign In or Register to comment.