gloomytrousers.co.uk

SQL Server utilities

A couple of useful Perl scripts for automating tasks in MS SQL Server - these write vast chunks of T-SQL for you, to save you having to do it yourself. I've used them on a number of commercial projects and they work quite well.

You can download the Windows version of Perl from ActiveState.

Audit logging

Screenshot from Enterprise Manager Takes a file containing details of your tables, creates a full audit (change) history for those tables.

Creates a trigger on each table to log all changes (INSERTs, UPDATEs and DELETEs) together with the user, machine and application that made them and the date and time they were made. The auditing, once created, is pretty much transparent to all users and operations. Will automatically connect to your database and generate all the scripts for you, which you can review and run to create all the necessary objects. If your tables change, just run it again - the history isn't overwritten.

Requires that each table you want to audit has a single integer (int, smallint or tinyint) primary key or other unique identifier.

CreateAudit-1.0.zip (v1.0, 17 Aug 2005, 13.7KB)

Stored procedure stubs

Takes files describing your tables/views and creates stored procedures for inserting, updating, deleting and selecting records, which you can either use as-is or as a base from which to work. Also creates ASP (VBScript) functions to call the stored procedures. Takes some of the legwork out of coding your DB application.

CreateTableSprocs.zip (v0.97a, 09 Sep 2002, 10.9KB)
Valid XHTML 1.0!
Valid CSS!
Non-humans only