Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912

    Unanswered: Execute Commented code

    Hi

    I read some time this year on Kalen Delaney's blog a tip on how to execute commented code in SSMS. I didn't bookmark and I can't find it now

    The gist was you could highlight the commented code and use some key combination. Handy when developing.

    I can't locate it. Sound familiar to anyone? Anyone know the key combination?

    Thanks!
    Testimonial:
    pootle flump
    ur codings are working excelent.

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    select commented code, press F5

    is that what you mean? surely not. I thought everyone knew this!

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ah! Should have specified the comment method. Not /*...*/, but --
    Code:
    --SELECT *
    --FROM sys.databases
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In her screen shot, she selected the code and pressed something and the highlight was only on the SQL Text, not on the comments text ("--"). I don't think vBulletin allows me to format text background to demonstrate....
    Last edited by pootle flump; 09-20-08 at 19:12.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    ...and for the pedants (not mentioning any names....except Pat), I mean I want it to execute the code as though uncommented, not execute the code including comments coz that is useless.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    If you were running emacs, I could send you 10 pages of LISP that would do it in a jiffy.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Ignoring those that consider me a bauble, in SSMS first highlight the code, comments and all.

    Press:

    Code:
    Ctrl-K, Ctrl-U		Uncomment the code
    Ctrl-E			Execute the code
    Ctrl-K, Ctrl-C		Re-comment the code
    Viola, or some other stringed instrument.

    -PatP

  8. #8
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    this also works:

    Ctrl-K, Ctrl-U Uncomment the code
    Ctrl-K, Ctrl-C Re-comment the code
    Ctrl-K, Ctrl-U Uncomment the code
    Ctrl-K, Ctrl-C Re-comment the code
    Ctrl-K, Ctrl-U Uncomment the code
    Ctrl-E Execute the code
    Ctrl-K, Ctrl-C Re-comment the code


  9. #9
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Is it the flumps' curse to be mocked and ridiculed at every turn?












    The answer is 'Yes' in case you didn't know.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Coo - just RTFMed. Didn't help with this problem (I also trawled KD's blog from start to end....and Kimberley Tripp's in case I got confuzzled) but it turns out you can switch to the old SQL 2k shortcuts (CTRL + SHIFT +C for comment. Woo Hoo!)
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    w00t! Found it:
    http://www.sqlmag.com/Article/Articl...ver_98516.html

    Um....has anyone else ever noticed the resemblance between Itzik Ben-Gan and Kalen Delaney?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  12. #12
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by pootle flump
    Is it the flumps' curse to be mocked and ridiculed at every turn?
    What other purpose might a flump have?

    -PatP

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Pat Phelan
    What other purpose might a flump have?

    -PatP
    ...................um..................lots....... ..........
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by pootle flump
    Um....has anyone else ever noticed the resemblance between Itzik Ben-Gan and Kalen Delaney?
    Emphatically not!

    When I encounter a lovely young lady that speaks fluent geek, I'm lost in tought... She knows the product "frout the inside out", mostly from being part of its history. She knows more about both the innards of SQL Server and of the folks involved in it than anyone else I know. She also has an impish side that is great fun.

    I've only talked with Itzik a few times. He is much more analytical and precise, even in casual conversation. He knows the product "from the outside in" as a result of much study and use. He has a great deal of experience applying the product to real world problems. At least in my limited experience, he is very focused all of the time.

    Physically... Well, both have one head, two arms, and two legs. Most human beings meet those criteria. Beyond that, I see more differences than similarities.

    Maybe I'm focusing on the wrong things. Can you point me in the right direction on this one Poots?

    -PatP

  15. #15
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    think poor poots was trying to make a joke. so misunderstood. sad.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •