Rob Gonda's Blog

The SQL odyssey continues: ListLen and ListLast

The SQL odyssey continues. Today I found myself writing a trigger for a VoIP call detail records table where some numbers came with special technical prefixes; the format was 945#5555555555… or sometimes even 123#456#5555555555

So instead of looping through the # signs with charindex, I decided to write ListLen and ListLast function to almost complete the collection.

In the trigger I had statements such as

 

IF dbo.ListLen(@number,’#’) = 3
 DO STUFF

Or to always get the dialed number regardless of the prefixes I used

 

SET @number = dbo.ListLast(@number,’#’)

Really helpful.

Get the functions here.

Security Advisory for all web developers

Just figured to share this.

Adobe flaw puts PCs at risk

You can download the patch here.

This blog is running version 5.9.003. Contact Blog Owner