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.