SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


A simple trick for “Block Comment” syntax in SSMS


A simple trick for “Block Comment” syntax in SSMS

Author
Message
zerko
zerko
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1108 Visits: 712
Comments posted to this topic are about the item A simple trick for “Block Comment” syntax in SSMS
reuben.anderson
reuben.anderson
Old Hand
Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)

Group: General Forum Members
Points: 339 Visits: 224
Oh, I love this stuff.

Thanks Zerko.
Carlo Romagnano
Carlo Romagnano
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8384 Visits: 3413
Wonderfull!
You gave me a good Idea.
:-D
ALZDBA
ALZDBA
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39027 Visits: 8995
nice and simple trick.

Thank you for sharing.

Johan


Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere w00t

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
Yiremyahu
Yiremyahu
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1543 Visits: 1072
I use comments to test changes to parameterised stored procedures without having to create or alter the sproc first.


/**/
CREATE PROC Test @param1 INT, @param2 VARCHAR(20) AS
--*/DECLARE @param1 INT/*
--*/DECLARE @param2 VARCHAR(20)/*
--*/

SELECT @param1, @param2



By breaking the close comment in the initial /**/ you coment out the CREATE (or ALTER) statement and uncomment the DECLARE statements.


/**-/
CREATE PROC Test @param1 INT, @param2 VARCHAR(20) AS
--*/DECLARE @param1 INT/*
--*/DECLARE @param2 VARCHAR(20)/*
--*/

SELECT @param1, @param2


Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)SSC Guru (69K reputation)

Group: General Forum Members
Points: 69251 Visits: 21434
This is exactly the technique I use in long 'utility' scripts and it works very well. I generally leave everything commented out until I need it, in case someone drops something on my F5 key Crazy

There is one additional thing I would like to be able to do though: select a block of text and then use a keyboard shortcut (like CTRL-K/CTRL-C) to automatically insert the /*[textblock]*/ around the block (/*[textblock]--*/ would be even better!).

I wonder if anyone has tried to do this?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
lshanahan
lshanahan
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1917 Visits: 438
Neat trick.

There is one additional thing I would like to be able to do though: select a block of text and then use a keyboard shortcut (like CTRL-K/CTRL-C) to automatically insert the /*[textblock]*/ around the block (/*[textblock]--*/ would be even better!).

I wonder if anyone has tried to do this?


All the built-in ways I could find on the various menus and such in SSMS (including stuff not shown by default) seem to use the double-dash type comment. I have heard about third-party add-ins that add macro capability to SSMS that might prove useful.

____________
Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.
Tee Time
Tee Time
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1271 Visits: 465
Thanks zerko!
Alex Friedman
Alex Friedman
SSC Veteran
SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)

Group: General Forum Members
Points: 233 Visits: 673
lshanahan (7/8/2013)
Neat trick.

There is one additional thing I would like to be able to do though: select a block of text and then use a keyboard shortcut (like CTRL-K/CTRL-C) to automatically insert the /*[textblock]*/ around the block (/*[textblock]--*/ would be even better!).

I wonder if anyone has tried to do this?


All the built-in ways I could find on the various menus and such in SSMS (including stuff not shown by default) seem to use the double-dash type comment. I have heard about third-party add-ins that add macro capability to SSMS that might prove useful.


The SSMSBoost add-in does it (along with some other neat stuff).
the sqlist
the sqlist
Right there with Babe
Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)

Group: General Forum Members
Points: 748 Visits: 743
How about the comment toggle trick:

-- Toggle trick
SELECT 'Toggle line 1' /*
SELECT 'Toggle line 2' --*/

By commenting line 1 line 2 becomes active.

Don't just give the hungry man a fish, teach him how to catch it as well.

the sqlist
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search