SQL Server 2012 (SP1) with 64GB ram using 50GB for max server memory
sp_configure 'locks' = 0
trace flags 1211 & 1224 are off
using READ_COMMITTED
SET LOCK_TIMEOUT 0
While using MERGE
I get this error:
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions.
Too many developers are experiencing ongoing problems with merge, so how else can we efficiently do cascading copy of rows and related rows for parent/child tables. E.g. tableA has many tableB rows and tableC has many tableD rows etc...
MERGE
is useful when creating the new identity values, while on the same row keeping the old identity to look back the data for the next table insert, is there alternatives?
Using the single table insert OUTPUT
command, we cannot get the old and new ID at the same time
INSERT INTO tableA
OUTPUT inserted.[ID],inserted.[col1],inserted.[col2],inserted.col3,
INTO #tmptable
What are the best options available to do this in SQL Server?