NULL as the Default Parameter

In the create procedure statement, you can declare null as the default value for individual parameters.

The syntax is:
create procedure procedure_name 
     @param datatype [ = null ]
     [, @param datatype [ = null ]]...

If the user does not supply a parameter, SAP ASE executes the stored procedure without displaying an error message.

The procedure definition can specify an action be taken if the user does not give a parameter, by checking to see that the parameter’s value is null. Here is an example:

create procedure showind3 
@table varchar(30) = null as 
if @table is null 
    print "Please give a table name." 
   select table_name =, 
     index_name =, 
     index_id = indid
   from sysindexes, sysobjects 
   where = @table 
   and = 

If the user does not give a parameter, SAP ASE prints the message from the procedure on the screen.

For other examples of setting the default to null, examine the source text of system procedures using sp_helptext.