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 (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

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

Group: General Forum Members
Points: 229 Visits: 222
Oh, I love this stuff.

Thanks Zerko.
Carlo Romagnano
Carlo Romagnano
SSCertifiable
SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)

Group: General Forum Members
Points: 6578 Visits: 3371
Wonderfull!
You gave me a good Idea.
:-D

I run on tuttopodismo
ALZDBA
ALZDBA
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21111 Visits: 8980
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: 1513 Visits: 1067
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-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35731 Visits: 20891
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
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1173 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
SSC Eights!
SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)SSC Eights! (839 reputation)

Group: General Forum Members
Points: 839 Visits: 465
Thanks zerko!
Alex Friedman
Alex Friedman
SSC-Enthusiastic
SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)

Group: General Forum Members
Points: 164 Visits: 666
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
Old Hand
Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)Old Hand (392 reputation)

Group: General Forum Members
Points: 392 Visits: 734
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