我有一个存储过程,我想在SELECT
下面使用,但出现错误。
存储过程的输出是一个包含一列类型的表int
select * from users where resCode in (EXEC getUserResselers 1)
-- stored procedure
create procedure getUserResselers
@userCode int
as
;WITH Directories AS (SELECT code FROM Resseler WHERE code =(select resselerCode from Users where code=@userCode)
UNION ALL SELECT d.code FROM Resseler d INNER JOIN Directories p ON d.parent = p.code)
SELECT * FROM Directories d