โ06-14-2023 01:38 PM
Given the below sql server procedure definition excerpt. How would we pass in an array of data into this this datatype as the input parameter of the stored procedure. when passing in a straight array of values we get the following error.
โreasonโ:
โExpected value in type:BUID_LIST for parameter:@BUIDS, but got value:[(โU00003601โ), (โU00007346โ), (โU00011341โ), (โU00011468โ), (โU00019947โ), (โU00026075โ), (โU00027687โ), (โU00038315โ), (โU00041258โ), (โU00043454โ)] in type:ArrayList.โ
/*
type dbo.BUID_LIST as TABLE (
BUID nvarchar(20) not null
);
go
*/
CREATE PROCEDURE [dbo].[UpdateHousingStudents]
โ Add the parameters for the stored procedure here
(@BUIDS dbo.BUID_LIST READONLY,
@Results nvarchar(200) OUTPUT)
AS
BEGIN
โ06-17-2023 11:18 AM
Hi @sdelano
You can pass it as a delimited string, then while the SP gets executed you can use SQL function STRING_SPLIT() and use it.
I hope this helps.
Cheers!