0
如何直接在SQLSERVER中將逗號分隔值傳遞給存儲過程?如何直接在SQL中將逗號分隔值傳遞給存儲過程
ALTER PROCEDURE [dbo].[CM_GetUnreadCount_ByUserJid_bilal_onlyfortesting] (@UserID AS VARCHAR(MAX))
AS
DECLARE @myTable TABLE (
MessageId BIGINT,
RecieverId VARCHAR(100)
)
INSERT INTO @myTable (
MessageId,
RecieverId
)
SELECT MAX(MessageID),
ReceiverID
FROM dbo.CM_MessageStatus
WHERE ReceiverID IN (@UserID)
AND DeliveredDate IS NOT NULL
GROUP BY ReceiverID
EXEC [CM_GetUnreadCount_ByUserJid_bilal_onlyfortesting] '123', '456'
錯誤:
Msg 8144, Level 16, State 2, Procedure CM_GetUnreadCount_ByUserJid_bilal_onlyfortesting, Line 0 Procedure or function CM_GetUnreadCount_ByUserJid_bilal_onlyfortesting has too many arguments specified.