NULL as the default parameter  Using more than one parameter

Chapter 16: Using Stored Procedures

Wildcard characters in the default parameter

The default can include the wildcard characters (%, _, [] , and [^]) if the procedure uses the parameter with the like keyword.

For example, you can modify showind to display information about the system tables if the user does not supply a parameter, like this:

create procedure showind4 
@table varchar(30) = "sys%" as 
select table_name = sysobjects.name, 
    index_name = sysindexes.name, 
    index_id = indid
from sysindexes, sysobjects 
where sysobjects.name like @table 
and sysobjects.id = sysindexes.id 




Copyright © 2005. Sybase Inc. All rights reserved. Using more than one parameter

View this book as PDF