Today was working on SQL Server cursor standard cursor deification would be like this: sqlcursor from (Azure Data Studio) ———————————————————————————————————————– — Declare a cursor for a Table or a View ‘TableOrViewName’ in schema ‘dbo’ DECLARE @ColumnName1 NVARCHAR(50), @ColumnName2 NVARCHAR(50) DECLARE db_cursor CURSOR FOR SELECT name FROM dbo.TableOrViewName OPEN db_cursor FETCH NEXT FROM db_cursor INTO @ColumnName1, @ColumnName2 WHILE @@FETCH_STATUS = 0 BEGIN — add instructions to be executed for every rows SELECT @db_nm FETCH NEXT FROM db_cursor INTO Sys.Databases END CLOSE db_cursor DEALLOCATE db_cursor GO … Continue reading