i have a TSQL code to move DATA from ORACLE to SQL SERVER. It is scheduled to run daily. But, for some reason it is not working as expected like taking a long time to finish execution and getting error like ERROR 3902 COMMIT TRANSACTION request has no Corresponding BEGIN TRANSACTION. The code was tested on the local server and was working properly. I have some doubts regarding certain parts of the code.
SOME CODE REGARDING MOVEMENT OF DATE FROM ORACLE TO SQL SERVER
GO
begin transaction
commit;
go
My doubts are as follows:
- I have read that GO is not a TSQL command. So, does it work in a scheduler?
- Begin TRANSACTION should start a transaction explicitly. But there is no code after BEGIN TRANSACTION. So how does it understand the above code should be executed?
I have solved the issue. Issue was with commit statement. After, every insert statement i added a commit(similar to pl/sql). I added begin transaction before every commit and it worked. I think commit works differently in pl/sql and TSQL.