SQL Mgmt Studio Editor quirk in Cut/Paste of variable names or temp table names inside a comment block

  • This is kind of an obscure thing I've noticed in SQL 2008 (not 2005), but it's starting to get under my skin. When in a comment block in SQL Mgmt Studio editor, when you double click on a variable name or a temp table name to select the string, the initial symbol, # or @, is omitted from the selection. Outside of a comment, your selection includes the full string with the initial symbol.

    To see this, copy these 2 lines to a SQL MGMT Studio edit window, and try double clicking on the variable strings:

    -- cut and paste @ThisString

    now cut and paste @ThatString

    In the first case, the selection is 'ThisString', and in the second case you get '@ThatString'

    Anybody else notice this? Any way to change this behavior?

    Thanks Steve

  • The editor is treating the commented text like a plain text editor, and leaves off of the @ like most any text editor will when you double-click the word. However, when it can be interpreted as an identifier, it selects the entire identifier.

    E.g., try this one in SSMS:

    --[here's a big long identifier! try double-clicking a single word and see what happens.]

    [here's a big long identifier! try double-clicking a single word and see what happens.]

    It gets rather annoying, as I'd rather have it be consistent. There's not a way to change this behavior to my knowledge. I reported it via connect several months ago and was told it would be corrected in a future version of SQL Server.

  • It does not work like that on my machine. When I copied your string, and clicked on a word, I got only that word.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply