Category Archives: Reference

Short references for personal… reference. Basically a howto for the tech-savvy.

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 […]

Writing a newline to separate commands in XChat

Just learned something neat: In XChat, if you hold ctrl and shift, and then press “u”, followed by “a”, you get a weird character that signifies a line break. This can be used to put several commands on one line in the configuration, or to type several lines before spamming them all at once into […]

MSSQL Mass Copy

To avoid locking a table for a damn long time, this is how Google told me to do mass copies of data in Microsoft SQL Server: DECLARE @BatchSize INT = 1000 DECLARE @IdMax INT = 25179272 DECLARE @i INT = 0 WHILE @i <= @IdMax BEGIN INSERT INTO [mydata].[dbo].[ProjectEventValues] WITH (TABLOCK) ([projectId] ,[descId] ,[index] ,[controllerId] […]

SMPS Repair

I recently had to repair the Switched Mode Power Supply for my RockWheel (a one-wheeled electric “vehicle”). Looking around for some general guidelines, since I hadn’t touched line voltage in a while, I found this guide over here useful. Archived here for archival purposes…

Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

This error seems to pop up every now and again when I configure a new IIS server, even if I do remember to check the ASP option during the initial role selection. Here’s how to resolve it (run as admin) on a 64-bit system: %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i ..and on a 32-bit system: %windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i

Enabling read_committed_snapshot on an existing MSSQL database

In short, for the database named “internal”: SELECT is_read_committed_snapshot_on,snapshot_isolation_state FROM sys.databases WHERE name=’internal’ ALTER DATABASE [internal] SET allow_snapshot_isolation ON ALTER DATABASE [internal] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE [internal] SET read_committed_snapshot ON ALTER DATABASE [internal] SET MULTI_USER SELECT is_read_committed_snapshot_on,snapshot_isolation_state FROM sys.databases WHERE name=’internal’