Hi ,
I have a string of numbers eg(1,2,3,4,5) which i pass to my stored pocedure as varchar ( @agentid shown in code below) now the problem i am facing is that agentid is int so it throws an error.
can some one tell me how to convert this string to int type
or is there a different way of sendig this list of int as for example can i send it like array or something
thanks for your help
following is my code
CREATE PROCEDURE [dbo].[spUSER_GetUserAgents]
@agentid varchar(500)
AS
SET NOCOUNT ON
SELECT
distinct con.AgentNo, isnull(c.LastName + ', ' + c.FirstName, 'N/A') AS AgentName
FROM
MPUserGroup con inner join contact c on con.AgentNo = c.ClientNo
WHERE
con.AgentNo in (@agentid)
ORDER BY
AGENTNAME
I have a string of numbers eg(1,2,3,4,5) which i pass to my stored pocedure as varchar ( @agentid shown in code below) now the problem i am facing is that agentid is int so it throws an error.
can some one tell me how to convert this string to int type
or is there a different way of sendig this list of int as for example can i send it like array or something
thanks for your help
following is my code
CREATE PROCEDURE [dbo].[spUSER_GetUserAgents]
@agentid varchar(500)
AS
SET NOCOUNT ON
SELECT
distinct con.AgentNo, isnull(c.LastName + ', ' + c.FirstName, 'N/A') AS AgentName
FROM
MPUserGroup con inner join contact c on con.AgentNo = c.ClientNo
WHERE
con.AgentNo in (@agentid)
ORDER BY
AGENTNAME