Page 180 - SQL
P. 180

WHILE @@FETCH_STATUS = 0
             BEGIN
                 PRINT @schema + '.' + @table + '.' + @column
                 --EXEC asp_DoSomethingStoredProc @UserId

             FETCH NEXT FROM columns_cursor --have to fetch again within loop
             INTO @schema, @table, @column

             END
             CLOSE columns_cursor
             DEALLOCATE columns_cursor

             -- End for each database





             FETCH NEXT FROM db_cursor INTO @db_name
         END

         CLOSE db_cursor
         DEALLOCATE db_cursor


        Read SQL CURSOR online: https://riptutorial.com/sql/topic/8895/sql-cursor























































        https://riptutorial.com/                                                                             162
   175   176   177   178   179   180   181   182   183   184   185