Posts

Showing posts from May, 2013

Vital settings for Microsoft Office if you're a developer or technician

Microsoft Office (including Visio) is designed for novel writers. If you're a developer or technician, most "helpful" and "intelligent" features hinder or destroy your work.  Writing code examples, formulas or technical jargong is tedious. But can be easier if you follow these settings. General File / Options / Advanced / (smart cut and paste) Settings /  Uncheck "Adjust sentence and word spacing automatically" This prevents Office from inserting spaces in front of what you paste. The setting will also be used in Outlook even if there's no setting there. Disable auto-capitalize first character. (also for outlook) Prevents Office from destroying your code casing Options / Proofing / AutoCorrect options / AutoFormat as you type Uncheck "Straight Quotes" with "Smart Quotes" Uncheck Hyphens with dash This malforms any code pasted Excel Options / Advanced / Use system separators Change to . (per...

T-sql merge to partial target table by where-clause

/* Example of how to merge partial set of target table  In this example I merge from #mysource to #mytarget, but only affect type='car' */   if   object_id ( 'tempdb..#mytarget' )   is   not   null     drop   table   #mytarget if   object_id ( 'tempdb..#mysource' )   is   not   null     drop   table   #mysource create   table   #mytarget   (   id   int   not   null ,     type   varchar ( 100 )   not   null ,      name   varchar ( 100 )   not   null   ) create   table   #mysource   (   id   int   not   null ,     type   varchar ( 100 )   not   null ,      name   varchar ( 100 )   not   null ...

Aggregate field to comma separated text

--Works good with numbers, careful with text due to xml-conversion select stuff( ( select ','+AnimalId from dbo.Animal as a for xml path('') ), 1,1,'') AS AggregatedAnimalIdsAsString