Tag Info

New answers tagged


The duplicate rows in the MSmerge_tombstone occurs when you restore the database with KEEP_REPLICATION bit. Its a good practice to configure replication from scratch since you never know that you run into some unknown issue just like you did. As confirmed by OP - drop the index uc1MSmerge_tombstone, delete the offending row and recreating the index fixes ...


Able to find the answer in another post... Sorry for raising this as duplicate DELETE `stn` FROM `snote` AS `stn` LEFT JOIN `bnote` AS `ban` ON `ban`.`bnote_id`=`stn`.`bnote_id` WHERE `ban`.`note_id`='5' AND `stn`.`bnote_id` = '10'


Deleting rows from a table does not automatically free up space, unless you happen to delete a large chunk of rows that are stored on the same pages, and every row on each such page was marked for deletion. You would need to rebuild the indexes in order to reclaim the space. Even if you rebuild the indexes, SQL Server doesn't reduce the size of the data ...


I've run into this kind of performance issue before, and breaking the delete up into discrete steps of a fixed size is what ended up doing the trick. It allows SQL Server to commit changes more frequently, which is generally easier on the transaction log. SELECT 'Begin Delete'; --gives @@ROWCOUNT a value WHILE @@ROWCOUNT <> 0 delete top (100000) ...


Thanks All for your effort. I found the solution. CodeIgniter where_in() added single quotation automatically, which is a bug in codeigniter. I use where() in place of where_in(). Issue fixed.


I had to do something very similar for a customer recently, and found that the best solution wasn't actually to use windowing functions, but was best done using APPLY and NOT EXISTS. With good indexing in place, the queries became nicely parallel with Nested Loops down to Seeks. The idea for your problem is to delete Starts when the next PhoneEvent is ...


You can start off with something like (assuming SQL Server 2012 or more recent) SELECT Lag(RowNum, 1) OVER (PARTITION BY PhoneID ORDER BY Tme) as DeleteMe FROM #TmpTable WHERE Lag(PhoneEvent, 1) OVER (PARTITION BY PhoneID ORDER BY Tme) IN ('Start Call', 'Start call') AND PhoneEvent IN ('Start Call', 'Start call') then you can wrap a ...

Top 50 recent answers are included