Friday, October 30, 2009

SQL functions to convert between bases

So I had an application where I wanted to convert between decimal and hex values, and while I found a few ways to do this with SQL, they didn't really give me what I wanted (the varbinary datatype is NOT what I was looking for). The largest issue was that the way the javascript on my CRM form converted to hex and the way SQL converted to hex were apparently not the same, and it was very annoying.

Thankfully, I found a couple of fantastic blog posts that help with this. Mr. Caldwell has created 2 functions for converting into and out of different bases, and they work wonderfully (and the same way that javascript does):
Convert Decimal to any other base
Convert any base to Decimal

Note that these are designed for SQL 2005 or above - I was able to apply one of the functions to SQL 2000 by changing the varchar(max) to varchar(255) (which was large enough for me.

Thursday, October 29, 2009

Cool script to display associated records in an iFrame

I found a few of these scripts that applied to CRM 3.0, but for 4.0, this blog post has a simple and easy to configure script for displaying related records (like the contacts under an account) in an iFrame. You only need to change the values at the top and the script does the rest!

http://mscrm4ever.blogspot.com/2009/05/crm-40-show-associated-view-in-iframe.html