Insert not commiting?

  • Declare GetCur Cursor For

    select FirstName, LastName from dbo._XMLImport

    Open GetCur

    Fetch Next From GetCur Into @FirstName, @LastName,

    While @@FETCH_STATUS = 0

    Begin

    SELECT @LeadId = convert(int,MAX(Lead__Id)) FROM Lead_

    PRINT(@LeadId)

    SET @TotLeadId = @LeadId + 1

    SET @Lead__Id = convert(binary(8), @TotLeadId)

    PRINT(@TotLeadId)

    PRINT(@Lead__Id)

    INSERT INTO dbo.Lead(Lead__ID, First_Name, Last_Name) values

    (@Lead__Id, @FirstName, @LastName)

    Fetch Next From GetCur Into @FirstName, @LastName

    End

    Close GetCur

    Deallocate GetCur

    End

    Result:

    91725

    91726

    0x000000000001664E

    91725

    91726

    0x000000000001664E

    How come the insert in not commiting on the cursor? any ideas?

  • Is there a trigger on the dbo.Lead table that may be causing a rollback of the transaction? Are you getting any kind of error message?

  • There is no trigger.

    I figure out.

    Thanks for replying.

  • CooLDBA (10/28/2009)


    There is no trigger.

    I figure out.

    Thanks for replying.

    And.... what did you figure out?

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Garadin (10/28/2009)


    CooLDBA (10/28/2009)


    There is no trigger.

    I figure out.

    Thanks for replying.

    And.... what did you figure out?

    Agreed. Forum etiquette says you should post any resolution you come up with if you have asked for help. Someone else may have a similiar problem as you and your resolution may help.

  • It's to do with the code. =)

  • CooLDBA (10/29/2009)


    It's to do with the code. =)

    Nothing this tells us, elaborate please.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply