Category Archives: Development

Incremental Insert from MySQL to MSSQL via SSIS with Variables

I recently inherited a SSIS package that moves a daily snapshot of a log table on a MySQL database over to a MSSQL database. The existing tasks truncate the destination tables and perform a fresh insert every night which works for now since the tables are relatively small. A log table, on the other hand, [...]

Selecting Odd or Even Rows with ABS() Function

Short little script that allows you to select Odd or Even rows from a table with an identity column: IF OBJECT_ID(‘tempdb.dbo.#TestData’,'U’) IS NOT NULL DROP TABLE #TestData; CREATE TABLE #TestData( ID INT IDENTITY(1,1) PRIMARY KEY NOT NULL, Glaven VARCHAR(100)) INSERT INTO #TestData(Glaven) SELECT NEWID() UNION SELECT NEWID() UNION SELECT NEWID() UNION SELECT NEWID() UNION SELECT NEWID() [...]

Monitoring a While Loop

When I’m running while loops I like to see what’s going on. The benefits to this are obvious. Here is a little script I like to use to see the number of items finishedout of the whole, the latest timestamp, and the currently processing item. First, let’s insert 10,000 rows to a temporary table. I’m [...]

Shredding XML Containing Different Roots & Nodes

While coding a recent report (the same one mentioned in my post on Querying AD with Linked Servers) I needed to shred a column with XML values. The challenge was twofold: the data was stored as VARCHAR(MAX), not XML, and contained malformed XML insofar as there were different root elements and different nodes inside the roots. [...]

Using a Linked Server to Query Active Directory

Recently I built a report that involved inserting Active Directory information to a temp table from within a stored procedure. Creating a linked server, testing it, and tracking down the information I needed took some time; this post documents the steps I took and the issues I encountered. All code is executed on SQL Server [...]