Monday, February 12, 2007

SSMS: T-SQL Intellisense Addins (Feedback)

After trying SQLAssist for a short while now, I have decided to removed it from my machine. I found it nice to work with but a lot of the time it would hang SSMS for few seconds. This afternoon while writing a query I hit Ctrl-F and it froze SSMS. Very annoying when you are in the middle of some hardcore development.

SQL Prompt is now priced at $195 which to me seems a little excessive. Oh well will have to carry on using my work around. I will place it here soon when I have created an installation package for it. Don't panic, my slap together version will definitely be free.

Thursday, February 8, 2007

SSIS : Writing to the event log

I recently had a discussion with a collegue of mine on how to write information to the event log. If you have tried this before you will see that the DTS.Event.FireError will write an error to the eventlog but the other events (Onwarning, OnInformation) won't. This can be a bit of a headache if you have any application that uses the Eventlog for notifications. To get over this hurdle I would suggest you add a script component to the event you are trying to capture and add the following code to it.

 

Imports System, System.Diagnostics, System.Data, System.Math, Microsoft.SqlServer.Dts.Runtime

' Must Include System.Diagnostics

Public Class ScriptMain

Public Sub Main()

Try

' Write whatever message you want. You may need to investigate what eventID you will use

EventLog.WriteEntry(
"Your Source", "Warning the database has gone off line", EventLogEntryType.Warning, 1001, 0)

' Report Error

Dts.TaskResult
= Dts.Results.Success

Catch ex As DtsException

Dts.Events.FireError(
CInt(ex.ErrorCode), Dts.Variables("System::TaskName").Value.ToString, ex.Message.ToString, String.Empty, 0)

End Try

End Sub

End Class


 


Note: You will need to add the the System.Diagnostics namespace to make this work.