get values within stored procedure

  • hi all,

    very simple question, mind not working this monday morning.

    how do i get a value from dynamic sql from within stored procedure

    e.g

      SELECT @Lookup = ViewName FROM #MyTempTable

       SET @sql = ' Select Count(*) From ' + @LookUp

       EXEC dbo.sp_executesql @sql

    I want to be able to get the value of Count(*) in the last statement above and use it in subsequent tsql in the same stored procedure.

    thanks!!!

     

     

     

  • found the solution, here ofcourse, just needed to use the OUTPUT parameter of sp_executesql.

    i knew it'd be something that simple!...:-)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply