tags:

views:

106

answers:

1

Is it possible ? CALL "DBA"."stored_proc"("iParameter" = 'value1','value1','value1','value1','value1') Or how to make this possible

A: 

Parameters must be given a system datatype (except text or image) or a user-defined datatype. I don't think there is a datatype that can hold a list of values.

However, you can use a default parameter that include a wildcard (%) - if the procedure uses the parameter with the like keyword.

For example, you can create a procedure 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 

Alternatively you can pass the suitable parameters for a query that returns this list of values and then create a temporary table (inside the stored procedure) and fill it with the list of values with a select into query. For more on temporary tables in stored procedures see here

gd047