Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Trigger update/delete/insert mssql
|
|||
|---|---|---|---|
|
#18+
Create a new table Production.ProductsHistory that will be used to store the history of changes in Production.Products. The history table should include the following columns: ID (primary key, identity); Action (varchar, will contain an action type Insert, Update or Delete); ModifiedDate (datetime); productid (the productid value from original Production.Products table); UserName (the name of user who applied changes). Create other columns if you think they are reasonable. Create a trigger for the INSERT, UPDATE and DELETE operations for the Production.Products table to save history of changes to the Production.ProductsHistory table. Try to insert, update or delete rows in the Production.Products. Verify the Production.ProductsHistory was populated. Try to affect several records in one operation (for example update 5 records in one UPDATE statement and verify all 5 records were added to the history). Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. Мой триггер пишет только первую изменяемую/удаляемую/вставляемую строку если это группа строк INSERT INTO TestSQL.Production.Products (productname, supplierid, categoryid, unitprice, discontinued) Values('Product AAAAA', 1, 5, 13.0000, 1), ('Product AAAAA', 1, 5, 15.0000, 1), ('Product AAAAA', 1, 5, 14.0000, 1), ('Product AAAAA', 1, 5, 16.0000, 1) с одиночными работает отлично подкажите, пожалуйста, как в history писать все изменения? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.02.2019, 16:34 |
|
||
|
Trigger update/delete/insert mssql
|
|||
|---|---|---|---|
|
#18+
Код: sql 1. 2. Далее самостоятельно. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.02.2019, 16:35 |
|
||
|
|

start [/forum/topic.php?fid=46&fpage=115&tid=1688332]: |
0ms |
get settings: |
8ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
36ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
34ms |
get tp. blocked users: |
1ms |
| others: | 267ms |
| total: | 376ms |

| 0 / 0 |
