Advertisement
ProgNeo

Untitled

Dec 8th, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. DECLARE @GroupID INT, @SubjectID INT
  2.  
  3. DECLARE GroupCursor CURSOR FOR
  4. SELECT Номер
  5. FROM Группа
  6.  
  7. OPEN GroupCursor
  8.  
  9. FETCH NEXT FROM GroupCursor INTO @GroupID
  10.  
  11. WHILE @@FETCH_STATUS = 0
  12. BEGIN
  13. DECLARE SubjectCursor CURSOR FOR
  14. SELECT ID
  15. FROM Предметы
  16.  
  17. OPEN SubjectCursor
  18.  
  19. FETCH NEXT FROM SubjectCursor INTO @SubjectID
  20.  
  21. WHILE @@FETCH_STATUS = 0
  22. BEGIN
  23. INSERT INTO Изучение (Группа_Номер, ID_Предмета, Часы, Вид_аттестации)
  24. VALUES (@GroupID, @SubjectID, 144, 'Экзамен')
  25.  
  26. FETCH NEXT FROM SubjectCursor INTO @SubjectID
  27. END
  28.  
  29. CLOSE SubjectCursor
  30. DEALLOCATE SubjectCursor
  31.  
  32. FETCH NEXT FROM GroupCursor INTO @GroupID
  33. END
  34.  
  35. CLOSE GroupCursor
  36. DEALLOCATE GroupCursor
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement