vSRO Paylaşım [RELEASE] Database Item Cloner | Copy _RefObjCommon + _RefObjItem by CommonID (Fast & Safe)

This release provides a stored procedure called __CopyItem that helps you copy an item definition from a SOURCE database to a DESTINATION database using the CommonID from _RefObjCommon.

It is useful when you have multiple shards/databases (e.g. SHARD_OLD→ SRO_VT_SHARD) and you want to copy an item without manually inserting rows.


What it does (Detailed)​


When you run the procedure with a @CommonID:
  1. It searches in SOURCE database:
  • _RefObjCommon by ID = @CommonID
  1. It reads the linked item ID:
  • _RefObjCommon. [Link] → this value is the item row ID in _RefObjItem
  1. It validates destination:
  • If _RefObjCommon.ID = @CommonID already exists in DEST → skip
  • If _RefObjItem.ID = Link already exists in DEST → skip
  1. If both IDs do not exist:
  • Inserts the Common row into DEST _RefObjCommon
  • Inserts the linked Item row into DEST _RefObjItem
  1. Everything runs inside a transaction:
  • If anything fails → rollback
  • If everything is OK → commit

IMPORTANT (MUST READ) – IDENTITY MUST BE OFF​


To make this procedure work correctly, you MUST ensure that ID is NOT IDENTITY (Auto Increment) in both tables:

  • _RefObjCommon.ID → IDENTITY = OFF
  • _RefObjItem.ID → IDENTITY = OFF


How to use​


*** Hidden text: cannot be quoted. ***



Parameters​

  • @CommonID : the _RefObjCommon.ID you want to copy
  • @SrcDB : source DB name
  • @DstDB : destination DB name (default: SRO_VT_SHARD)


Output / Results​

The procedure prints status messages like:
  • Inserted OK: CommonID X and ItemID Y
  • Skipped: Common ID already exists in DEST
  • Skipped: Item ID (Link) already exists in DEST

*** Hidden text: cannot be quoted. ***


Wow, thanks for release sir
 
This release provides a stored procedure called __CopyItem that helps you copy an item definition from a SOURCE database to a DESTINATION database using the CommonID from _RefObjCommon.

It is useful when you have multiple shards/databases (e.g. SHARD_OLD→ SRO_VT_SHARD) and you want to copy an item without manually inserting rows.


What it does (Detailed)​


When you run the procedure with a @CommonID:
  1. It searches in SOURCE database:
  • _RefObjCommon by ID = @CommonID
  1. It reads the linked item ID:
  • _RefObjCommon. [Link] → this value is the item row ID in _RefObjItem
  1. It validates destination:
  • If _RefObjCommon.ID = @CommonID already exists in DEST → skip
  • If _RefObjItem.ID = Link already exists in DEST → skip
  1. If both IDs do not exist:
  • Inserts the Common row into DEST _RefObjCommon
  • Inserts the linked Item row into DEST _RefObjItem
  1. Everything runs inside a transaction:
  • If anything fails → rollback
  • If everything is OK → commit

IMPORTANT (MUST READ) – IDENTITY MUST BE OFF​


To make this procedure work correctly, you MUST ensure that ID is NOT IDENTITY (Auto Increment) in both tables:

  • _RefObjCommon.ID → IDENTITY = OFF
  • _RefObjItem.ID → IDENTITY = OFF


How to use​


*** Gizli metin: alıntı yapılamaz. ***



Parameters​

  • @CommonID : the _RefObjCommon.ID you want to copy
  • @SrcDB : source DB name
  • @DstDB : destination DB name (default: SRO_VT_SHARD)


Output / Results​

The procedure prints status messages like:
  • Inserted OK: CommonID X and ItemID Y
  • Skipped: Common ID already exists in DEST
  • Skipped: Item ID (Link) already exists in DEST

*** Gizli metin: alıntı yapılamaz. ***


thanks
 

Bu konuyu görüntüleyen kullanıcılar

Etiketler
Geri
Üst Alt