I have a procedure that I send a string param into it with this structure 10,11,12
.
And I want to split it with comma (,
) and delete records in the table that contains these ids.
My procedure:
ALTER PROCEDURE [dbo].[deleteDeal]
@orderIds varchar(100)
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM deal
WHERE OrderId IN (SELECT OrderId
FROM STRING_SPLIT(@orderIds, ','));
END
But this code deletes all rows from the deal
table.
How can I do this action?