title: Can I get the results of a stored procedure into a cursor within another stored procedure in SQL
body: <p>I'm trying to put the results of a stored procedure into a cursor to use within the current procedure. I've added my code below but I'm not sure if this is possible or if my syntax is correct?</p>
  
  <pre><code>DECLARE cursorIDList CURSOR FOR
      EXEC spGetUserIDs
  OPEN cursorIDList
  
  FETCH NEXT FROM cursorIDList INTO @ID
  </code></pre>
  
  <p>I receive the following error: Incorrect syntax near 'EXEC'. Expecting SELECT, '(' or WITH.</p>
  
  <p>Thanks in advance.</p>