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.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: 1266 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-Addicted
SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)

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

Thanks Zerko.
Carlo Romagnano
Carlo Romagnano
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12444 Visits: 3519
Wonderfull!
You gave me a good Idea.
:-D
ALZDBA
ALZDBA
SSC Guru
SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)

Group: General Forum Members
Points: 71388 Visits: 9210
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.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 1089
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 (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)SSC Guru (129K reputation)

Group: General Forum Members
Points: 129683 Visits: 22606
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
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3249 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
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2013 Visits: 465
Thanks zerko!
Alex Friedman
Alex Friedman
Old Hand
Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)Old Hand (362 reputation)

Group: General Forum Members
Points: 362 Visits: 678
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
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: 1266 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