Split Text File Based on Size

Quick script for today.  I needed to come up with a way to split a text file, specifically a SQL script with one insert statement per line up into smaller files if the base file exceeded a certain size.  The requester of this functionality wanted the file to be split into 10,000 line chunks if it exceeded 5000KB.

Continue reading

Recursive CTE

I was recently tasked with coming up with a stored procedure that would accept an Active Directory username, and return basically an organizational tree about that user.  This includes peers (other employees with the same manager), direct manager, and the rest of the management tree up to the CEO-level.

Continue reading