Set Identity_Insert On and Off

Home Forums kbmMW Set Identity_Insert On and Off

Viewing 2 reply threads
  • Author
    Posts
    • #54357
      jet2050
      Participant

      Hello Kim

      How can I “resolve” changes on the server using the following?
      <div>SET IDENTITY_INSERT sometableWithIdentity ON</div>
      <div>INSERT sometableWithIdentity (IdentityColumn, col2, col3, …)VALUES (AnIdentityValue, col2value, col3value, …)</div>
      <div>SET IDENTITY_INSERT sometableWithIdentity OFF</div>
      <div></div>
      <div>Using the components of KbmMW,  TbkMWClientQuery while doing the normal open, append, post, resolve.</div>
      Thanks in advance.

      Best regards

      Job Espejel

    • #54359
      kimbomadsen
      Keymaster

      Hi,

      You can write an eventhandler on the resolver’s OnBeforeObjectOperation and OnAfterObjectOperation.

      Check if its state is mwrssInsert, and if your resolver is being used for other resolving, you probably also need to check if its that particular situation you want to interfere with the operation.

      Then in the OnBeforeObjectOperation execute your SET IDENTITY… ON on the connection that is provided by the Sender.

      Similarly with the SET IDENTITY…. OFF in the OnAfterObjectOperation event.

      best regards

      Kim/C4D

    • #54362
      jet2050
      Participant

      thanks !!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.