Wednesday, March 25, 2015

top variable needs parentheses

declare @int int = 10

select top (@int) * from

bozo

more things done to improve sql

if force order hint is used - put left joins after inner joins
create indicies on temp tables after inserts

Tuesday, March 24, 2015

Tuesday, March 17, 2015

Monday, March 9, 2015

to avoid distributed transaction errors during debugging

on the callee comment out :

/*[OperationBehavior(TransactionScopeRequired = true,
TransactionAutoComplete = true)]*/

Thursday, February 26, 2015

debugging a windows service

follow this pattern in program file

#if DEBUG
            MethodInfo mi = qCenterService.GetType().GetMethod("OnStart", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic);
            mi.Invoke(BlahService, new object[] { new string[0] });
            Console.ReadLine();
#else
                     ServiceBase.Run(new ServiceBase[] { BlahService });

#endif

Monday, February 16, 2015

recent things done to an important and complex sql query to improve performance


  1. changed cross- apply to cte's
  2. added indices that had all the output columns needed instead of using clustered index which forced more reads
  3. removed max varchar columns from initial query to avoid key lookups and retrieved them at end of sql