Category Archives: Tech

SQL Server Monitor Changes to SCHEMA

If you need to prevent changes to your SQL Server Schema, or at least monitor them, then this post is worth reading

I needed to monitor/control changes made to SQL server databases at server instance level. There are plenty of ways of doing this but there is nothing as simple as a DDL level trigger. It’s clean, can be disabled quickly for rapid change implementation and its a central location which means deploying to sever SQL Servers or a server farm is that much easier.

So the basic requirements
1. We must be able to monitor CREATE,DROP and ALTER on Tables, Views, Stored Procedures, Triggers and Functions
2. We must be able to filter based on user, applying the rule or not
3. We must have a log of each schema change regardless of success or failure
4. We need to send an email when a change has been attempted and was disallowed

So how are we going to do this. Well we can use the ROLLBACK inside our trigger to prevent the changes from occurring, and we can use the RAISERROR to display the appropriate message we want to user/program to receive when the attempt fails. We can also take advantage of the code SQL Server query execution sequence such that after a rollback has been called in a trigger, the parent transaction has been dumped, but any further transactions will continue to be executed and committed. See here

Some Key fundamentals we are going to be using
First off the

, this will allow us to create the trigger at server level, so it affects all databases. It will hence be located in the Server Objects >> Triggers within SQL Server Management Studio
Next comes

which contains all the details we want about what is changing and who is trying to change it
We will be using “

” to identify the current logged in connection that is behind the event and also filter on this to make a decision to reject or approve the change.
Finally we use the


commands to initiate a rejection of the event, followed with our logging insert and in my case an email send method, I won’t get into the details of the mail sending in this article, however its worth mentioning that I have a fully fledged SSIS package driven mail sending engine integrated with MS Exchange, its possible to send from any mailbox to any mail group or address in the active directory or individual mail address book, you can attach files from the network or from binary within the database, you can send with importance in text format or html as this example demonstrates, Its a very powerful and very handy engine to have in the systems topology, took 3 days to write and about a month to fine tune, suddenly sending mail is very easy from anywhere in your infrastructure. Anyway I digress

Enough background, here’s the Code. You will obviously need to adjust bits to suite your needs before you use this
This should be executed against the master

numark dj2go traktor midi map

This is the midi mapping I created for the Numark dj2go

I’ve mapped all the essential controls to the best Traktor controls possible bar the folder navigation jog and the back and enter key.

I couldn’t find a map anywhere online, though I did see many posts discussing mapping to deck C and D. This mapping has mapped to Deck A and B

[UPDATE] : the sync buttons were mapped but were not correctly set, I have changed them from “hold” to “toggle” so the sync is toggled on and off.
Traktor Midi Map for DJ2GO.tsi

[UPDATE]: Numark have released their version of the midi map here

People have been complaining about it though – so i might blend the two together.

How To Restore All Your HTC Widgets

Recently my htc widgets have not been available for my home screen (friend stream, mail music, twitter etc) Im not sure what caused it but none the less its happened.

To get them back is pretty simple.

Note: this will completely reset your home screen layouts and wipe any saved layouts
1. Make sure you have over 15mb free space2. Open Settings
3. Select Applications
4. Select Manage Applications5. Scroll to HTC Sense and select it
6. Hit Clear data
7. Press the home button and wait
8. You will now see your widgets available when trying to add via one of the home screens

Chrome to Phone – the gap closes

Google has released a pretty cool plugin for its chrome browser call chrome to phone

The idea is to be able to push things to your phone on the fly. Things like navigation directions can be worked out in the browser then sent to the phone, this kick-starts the navigation on the phone and away you go.
The url of page can also be sent, or a phone number currently highlighted.
You can even highlight text which when sent will hit your clipboard.

The gap between pc’s and mobile devices is forever decreasing. I wonder where we will be in 10 years….

The plugin also extends to firefox

google chrome plugin

the app for your android