The Rollback transaction request has no corresponding begin transaction
<p>i have used Save Transaction and rollback but still the same exception occur.</p>

<p>it gives me this error:</p>

<blockquote>
  <p>Msg 3903, Level 16, State 1, Procedure HALAQATI_ttttttttttttt, Line
  144 The ROLLBACK TRANSACTION request has no corresponding BEGIN
  TRANSACTION.</p>
</blockquote>

<p>Update </p>

<blockquote>
  <p>Msg 50000, Level 16, State 1, Procedure HALAQATI_ttttttttttttt, Line
  160 usp_my_procedure_name: 102: Incorrect syntax near '='.</p>
</blockquote>

<p>the stored procedure is :</p>

<pre><code>ALTER Proc [dbo].[HALAQATI_ttttttttttttt]
                @tf_commentparam nvarchar(100),
                @tf_secsuggdate int,
                @tf_testplace nvarchar(50),
                @tf_time nvarchar(7),
                @tf_day int,
                @an_id int,
                @ResponseText nvarchar(max) out,
                @ResponseNum int out -- (0 = everything is ok , 1 = error or wrong data)

AS
    DECLARE @startingTranCount int
    SET @startingTranCount = @@TRANCOUNT
Begin
SET XACT_ABORT ON
SET NoCount ON
    BEGIN TRY
    IF @startingTranCount &gt; 0
        SAVE TRANSACTION mySavePointName
    ELSE
        BEGIN TRANSACTION

            DECLARE @return_value_FIRST int,
                @tf_id int,
                @createddate int,
                @UnitIDFromStudentID int,
                @StudentIDFromAutoNominationID int

            set @createddate  = (select dbo.f_getHijNowByInteger());

            set @StudentIDFromAutoNominationID = (select st_id from tbl_autonomination where an_id = @an_id);

            set @UnitIDFromStudentID =  (select sec_id from tbl_secmsq where sm_id = 
                                        (select sm_id from tbl_ring where rg_id = 
                                        (select Ring_ID from HALAQATI_VIEW_GetAllStudents where Student_ID = @StudentIDFromAutoNominationID)))
                                        --/////////////////////////////////--
            DECLARE @return_value_SECOND int,@msg nvarchar(500)

            Declare @BranchNumFromAnID int = (select ne_branchno from tbl_nomineeexam where an_id = @an_id)
                                        --/////////////////////////////////--
            DECLARE @return_value_THIRD int
                                        --/////////////////////////////////--

    EXEC        @return_value_FIRST = [dbo].[sp_inserttestform]
                @tf_comment = @tf_commentparam,
                @tf_date = @createddate,
                @tf_secsuggdate = @tf_secsuggdate,
                @tf_testplace = @tf_testplace,
                @tf_unittype = 1, -- قطاع
                @tf_unitid = @UnitIDFromStudentID,
                @tf_id = @tf_id OUTPUT,
                @tf_userid = 10,--رقم جلال سعيد في التعليمية,
                @tf_type = 1, --آلي
                @tf_time = @tf_time,
                @tf_day = @tf_day,
                @tf_TFtype = 1 -- أجزاء

                if (@return_value_FIRST != 0 and @tf_id is null)
                begin

                    if (@return_value_FIRST = 1)        
                        begin
                            set @ResponseText  =  'أقل من يوم وأكثر من 15 يوم' 
                            set @ResponseNum = 1
                            return
                        end
                    else if (@return_value_FIRST = 2)
                        begin
                            set @ResponseText = 'لايوجد نقاط كافية للترشيح'
                            set @ResponseNum = 1
                            return
                        end
                    else if (@return_value_FIRST = 3)
                        begin
                            set @ResponseText = 'لم يتم ربط مركز الإشراف أو المجمع بمشرف لجان'
                            set @ResponseNum = 1
                            return
                        end
                    else
                        begin
                            set @ResponseText =  'هناك خطأ حاول في وقت لاحق' 
                            set @ResponseNum = 1
                            return
                        end
                                IF @startingTranCount &gt; 0
                            ROLLBACK TRANSACTION MySavePointName
                        ELSE
                            ROLLBACK
                End

    EXEC        @return_value_SECOND = [dbo].[sp_insertAutoNominee]
                @tf_id = @tf_id,
                @st_id = @StudentIDFromAutoNominationID,
                @an_id = @an_id,
                @ne_branchno = @BranchNumFromAnID,
                @ne_userid = 10,
                @msg = @msg OUTPUT

                if (@return_value_SECOND != 0 or @return_value_SECOND is not null)
                    begin
                         --ROLLBACK TRANSACTION

                         if CHARINDEX('بنفس الفرع ونتيجته ناجح',@msg) &gt; 0
                            begin
                                set @ResponseText  = 'لا يمكن إضافة ترشيح للطالب لأن له ترشيح سابق بنفس الفرع ونتيجته ناجح أو لم يختبر بعد'
                                set @ResponseNum = 1
                                return
                            end              
                         if CHARINDEX('خلال السبعة أيام',@msg) &gt; 0
                            begin
                                set @ResponseText  = 'لا يمكن إضافة ترشيح للطالب لأنه غاب عن اختبار في نفس الفرع خلال السبعة أيام الماضية'
                                set @ResponseNum = 1
                                return
                            end                      
                         if CHARINDEX('خلال الأربعة عشر يوماً',@msg) &gt; 0
                            begin
                                set @ResponseText  = 'لا يمكن إضافة ترشيح للطالب لأنه رسب في نفس الاختبار خلال الأربعة عشر يوماً الماضية'
                                set @ResponseNum = 1
                                return
                            end             
                                IF @startingTranCount &gt; 0
                            ROLLBACK TRANSACTION MySavePointName
                        ELSE
                            ROLLBACK                    
                    end

    EXEC        @return_value_THIRD = [dbo].[sp_changeTFState]
                @tf_state = 4,
                @tf_id = @tf_id,
                @tf_chatsys = NULL,
                @tf_testdate = @tf_secsuggdate,
                @tf_time = @tf_time,
                @tf_day = @tf_day,
                @ne_cerprintdate = NULL

                IF @startingTranCount = 0

                    set @ResponseText = 'تم إعتماد و ترشيح الطالب إلى الإختبار بنجاح , وتم إرسال كافة البيانات إلى قسم الإختبارات في الجمعية'
                    set @ResponseNum  = 0
                    COMMIT
    END TRY
    --BEGIN CATCH
    --IF @startingTranCount &gt; 0
    --  ROLLBACK TRANSACTION MySavePointName
    --ELSE
    --  ROLLBACK TRANSACTION
    --  set @ResponseText = ERROR_MESSAGE ()   
    --  set @ResponseNum = 1
    --END CATCH  
       begin catch
        declare @error int, @message varchar(4000), @xstate int;
        select @error = ERROR_NUMBER(), @message = ERROR_MESSAGE(), @xstate = XACT_STATE();
        if @xstate = -1
            rollback
        if @xstate = 1 and @startingTranCount = 0
            rollback
        if @xstate = 1 and @startingTranCount &gt; 0
            rollback transaction usp_my_procedure_name;

        raiserror ('usp_my_procedure_name: %d: %s', 16, 1, @error, @message) ;
    end catch   
End
</code></pre>