Sunday, May 19, 2013

Excel Formulas: Separating String Values between spaces

place these formulas side by side in two columns..

=LEFT($A1,FIND(" ",$A1)-1)
=RIGHT($A1,FIND(" ",$A1)-1)

Wednesday, May 1, 2013

Performing a Batch Delete

hi,
use a batch DELETE, e.g. something like

DECLARE @batchSize INT
SET @batchSize = 10000

WHILE (SELECT COUNT(*) FROM yourTable WHERE yourCondition) > 0
BEGIN
  DELETE  FROM yourTable
  WHERE   primaryKey IN ( SELECT TOP ( @batchSize )
                                  primaryKey
                        FROM      yourTable
                        WHERE     yourCondition ) ;
END ;
 
of course using EXISTS is faster:
WHILE EXISTS(SELECT * FROM yourTable WHERE yourCondition)