Advertisement
brunobola

Untitled

May 12th, 2023
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.55 KB | None | 0 0
  1. /*
  2. Script created by SQL Data Examiner 7.1.8.338 at 12-05-2023 16:35:42.
  3. Run this script on [192.168.0.4,1983].PRITPB to make it the same as PRIMAVERAV10.PRITPB
  4. */
  5. BEGIN TRANSACTION
  6.  
  7. BEGIN TRY
  8.  
  9.  
  10. --Updating [dbo].[TDU_UnidadeNegocio] (5 records)
  11. UPDATE [dbo].[TDU_UnidadeNegocio] SET [CDU_CC] = 1 WHERE [CDU_Codigo] = N'CC'
  12. UPDATE [dbo].[TDU_UnidadeNegocio] SET [CDU_CC] = 1 WHERE [CDU_Codigo] = N'CS'
  13. UPDATE [dbo].[TDU_UnidadeNegocio] SET [CDU_PV] = 1, [CDU_CC] = 1 WHERE [CDU_Codigo] = N'EQ'
  14. UPDATE [dbo].[TDU_UnidadeNegocio] SET [CDU_PV] = 1, [CDU_CC] = 1 WHERE [CDU_Codigo] = N'ES'
  15. UPDATE [dbo].[TDU_UnidadeNegocio] SET [CDU_PV] = 1 WHERE [CDU_Codigo] = N'PV'
  16.  
  17.  
  18. --End of transaction
  19. PRINT 'Commit synchronization.'
  20. COMMIT TRANSACTION
  21.  
  22. END TRY
  23. BEGIN CATCH
  24.     --If during synchronization process an error occurred then the following code will be executed
  25.     IF @@error <> 0 AND @@trancount > 0
  26.     BEGIN
  27.         DECLARE @EX_ERROR_MESSAGE nvarchar(MAX), @STATE INT, @SEVERITY INT
  28.         SELECT @EX_ERROR_MESSAGE =
  29.         'An error occurred:' + CHAR(13) + CHAR(10)
  30.         + 'Msg ' + CAST( ERROR_NUMBER() AS nvarchar(20) )
  31.         + ', Level ' + CAST( ERROR_SEVERITY() AS nvarchar(20) )
  32.         + ', State ' + CAST( ERROR_STATE() AS nvarchar(20) )
  33.         + ', Line ' + CAST( ERROR_LINE() AS nvarchar(20) ) + CHAR(13) + CHAR(10)
  34.         + ERROR_MESSAGE() + CHAR(13) + CHAR(10),
  35.         @SEVERITY = ERROR_SEVERITY(),
  36.             @STATE = ERROR_STATE()
  37.         RAISERROR(@EX_ERROR_MESSAGE, @SEVERITY, @STATE)
  38.     END
  39.     ROLLBACK TRAN
  40.     PRINT 'Data synchronization is completed with errors, all changes were cancelled'
  41. END CATCH
  42.  
  43.  
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement