DECLARE @ONYX_ID INT
DECLARE cur CURSOR FOR
SELECT iIndividualID
FROM [ONYX_KAPLAN].[dbo].[Individual]
WHERE iIndividualID <= 1010918
OPEN Cur
FETCH NEXT From cur INTO @ONYX_ID
WHILE @@FETCH_STATUS = 0
BEGIN
----How to say not to create result set if no value-----------
---Unable to create temp table in this database-------
EXEC csprgCustomerProduct_TranscriptItem_KAP @ONYX_ID
FETCH NEXT FROM Cur INTO @ONYX_ID
END
CLOSE Cur
DEALLOCATE Cur
答案 0 :(得分:0)
根据我的理解,如果csprgCustomerProduct_TranscriptItem_KAP
不返回任何记录,则您不需要结果集。
因此,您可以在过程结果集中使用IF EXISTS。如果在您的返回查询中存在比的记录,那么它应该给出结果,否则就没有结果集。