Slash-asterisk style comments

The /* style comment is a Transact-SQL extension. Multiple-line comments are acceptable, as long as each comment starts with “/*” and ends with “*/”. Everything between “/*” and “*/” is treated as part of the comment. The /* form permits nesting.

A stylistic convention often used for multiple-line comments is to begin the first line with “/*” and subsequent lines with “**”. End such a comment with “*/” as usual:

select * from titles 
/* A comment here might explain the rules 
** associated with using an asterisk as 
** shorthand in the select list.*/ 
where price > $5 

This procedure includes several comments:

/* this procedure finds rules by user name*/ 
create procedure findmyrule @nm varchar(30) = null 
as 
if @nm is null 
begin 
  print "You must give a user name" 
  return 
  print "I have returned" 
/* this statement follows return, 
** so won’t be executed */ 
end 
else      /* print the rule names and IDs, and 
          the user ID */ 
  select sysobjects.name, sysobjects.id,
     sysobjects.uid
  from sysobjects, master..syslogins 
  where  master..syslogins.name = @nm 
  and sysobjects.uid = master..syslogins.suid 
  and sysobjects.type = "R"