I am trying to add multiple value to a parameter of a SQL Server stored procedure.
The name of the stored procedure is gpCompRes, parameter is @ProgramID
I need to add 200 + integers to ProgramID and I tried something like this
CREATE TYPE Programs as TABLE (Programs INT)
GO
DECLARE @ProgramID Programs INT
INSERT INTO @ProgramId
VALUES (12071), (66306)
EXEC gpCompRes @ProgramId = Programs,
@OrganisationId = 1122,
@UserIdList = 3326,
@ActionUserId = 2255;
GO
I tried another option from the other stack flow which is also not working in my case to just declare and insert values but it did not work.
Thanks
Declare @ProgramID Programs INT? You have 2 datatypes there.Programsandint. Remove theINT:Declare @ProgramID Programs;TYPEPrograms` already exists, you can'tCREATEit, @Preki , that much is obvious. Considering that the Stored proceduregpCompReswill already haveProgramsas the datatype for the parameter@ProgramIDthen then would suggest it does already exist. And then, for the latter, as I said, you haveProgams INT; theINTshouldn't be there. Seems like a typographical error.