Skip to main content

https://codingsight.com/passing-data-table-as-parameter-to-stored-procedures/

To pass large amounts of data to a performance sensitive stored procedures we would like to pass a table as a parameter to a stored procedure as described in the article above.

For this we need to define a type/domain as a table, and we need to set the parameter of a stored procedure to read only. Those are both options currently not available to us in the SF.

Could this be made possible please? The idea is described in the attached link.

Updated idea statusNewOpen

Updated idea statusOpenOn the backlog

We’ve evaluated this idea further. The table-typed domains would have to be exclusive to subroutines as they are database-platform specific and should not interfere with tables and logic procedures called from the UI or service tier.

While we are considering how to implement this, there are alternatives available. You can pass tabular  information to stored procedures via temp tables.

create procedure process_data
as
begin
select *
from #tabular_data
end
go

You will need to be strict on the structure and managing of the temp tables, but you can pass information as following from outside of the procedure.

select 
1 as customer_id,
'Test' as customer_name
into #tabular_data

exec process_data

drop table #tabular_data