Category Archives: Windows

Stuff about Microsoft’s answer to elevator music

Wiping an (Azure) SQL Server database, deleting all tables

Just for personal reference USE [mydb] GO WHILE(EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE=’FOREIGN KEY’)) BEGIN DECLARE @sql0 NVARCHAR(2000) SELECT TOP 1 @sql0=(‘ALTER TABLE [‘ + TABLE_SCHEMA + ‘].[‘ + TABLE_NAME + ‘] DROP CONSTRAINT [‘ + CONSTRAINT_NAME + ‘]’) FROM information_schema.table_constraints WHERE CONSTRAINT_TYPE = ‘FOREIGN KEY’ EXEC (@sql0) PRINT @sql0 END GO DECLARE @sql1 NVARCHAR(2000) […]

Using MERGE to insert/update in SQL Server

After finding various useless references on how to use the MERGE statement in SQL Server 2008, I found this one that I could use, so I copied it here for personal reference: MERGE tablename AS target USING (VALUES (‘new value’, ‘different value’)) AS source (field1, field2) ON target.idfield = 7 WHEN MATCHED THEN UPDATE SET […]

MSSQL Mass Delete

To avoid holding up everything else when deleting massive amounts of data from an SQL Server table, you can use the TOP() function to delete the data in chunks. SELECT 1 WHILE @@ROWCOUNT > 0 BEGIN DELETE TOP(1000) FROM [dbo].[mytable] WHERE timestampUtc < ‘2015-05-29’ END The “SELECT 1” primes the @@ROWCOUNT variable, so the while […]

Installing Windows Live Essentials on Windows XP – Error: OnCatalogResult: 0x80190194

wlsetup-all-en_GB wlsetup-all-en_USSupport for Windows XP from Microsoft has long since ended, and although Windows Update still kind of works (you have to run the “Express” option a few times, and install Microsoft Update, before “Custom” works), attempts to install Windows Live Essentials fail miserably with the cryptic error message “OnCatalogResult: 0x80190194”. Downloading the installer manually […]

Weakening Windows Server 2012

Sometimes, when I’m just screwing around with some software, Windows security just gets in my way. Here are the things I wanted gone this time, and where to find them: Strong password enforcement and password aging: Administrative tools => Local Security Policy (secpol.msc) => Account Policies => Password Policy Ctrl+alt+del to login: Administrative tools => […]