Little Debugging..
CREATE PROCEDURE sp_GetEZQueryList
(
@sUser AS nchar(500) ,
@sSupervisor AS char(1) ,
@sAllowed AS varchar(8000)
)
AS
IF @sSupervisor <> 'Y'
SELECT
EzqDateMod ,
EzqFlxID ,
EzqUserName ,
EzqName ,
EzqData ,
EzqDescrip
FROM
EZQuery
WHERE
( EzqUserName = @sUser )
OR
( EzqUserName = 'SYSTEM' /*AND CAST(EzqFlxID AS varchar(10)) IN ( SELECT * FROM intlist_to_tbl WHERE(@sAllowed) ) */)
ELSE
SELECT
EzqDateMod ,
EzqFlxID ,
EzqUserName ,
EzqName ,
EzqData ,
EzqDescrip
FROM
EZQuery
GO
exec sp_getezquerylist 'DO''SULLIVAN', 'N', '100'
Executes fine, without the IN clase to look up The source of your issues appear to be in this function (I assume its a function based on the nomenclature) intlist_to_tbl. If intlist_to_tbl is really a function why are you sending that data to the db, and converting it instead of storing it in the db?
Common sense is admitting there is cause and effect and that you can exert some control over what you understand.