Double-hyphen style comments

This comment style begins with two consecutive hyphens followed by a space (-- ) and terminates with a new line character. Therefore, you cannot use multiple-line comments.

Adaptive Server does not interpret two consecutive hyphens within a string literal or within a /*-style comment as signaling the beginning of a comment.

To represent an expression that contains two consecutive minus signs (binary followed by unary), put a space or an opening parenthesis between the two hyphens.

Following are examples:

-- 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" 
-- each line of a multiple-line comment 
-- must be marked separately.
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"