_

_

I’m slowing down posting lately, if you hadn’t noticed. Instead of trying to post something everyday on days when I just don’t have anything I like, I’ve decided to just not post. I’m sort of taking a breather and will only be posting every couple of days or so. I plan on diving back in full boar in the coming weeks.

Our deepest fear


Our deepest fear is not that we are inadequate. Our deepest fear is that we are powerful beyond measure. It is our light, not our darkness that most frightens us. We ask ourselves, Who am I to be brilliant, gorgeous, talented, fabulous? Actually, who are you not to be? You are a child of God. Your playing small does not serve the world. There is nothing enlightened about shrinking so that other people won’t feel insecure around you. We are all meant to shine, as children do. We were born to make manifest the glory of God that is within us. It’s not just in some of us; it’s in everyone. And as we let our own light shine, we unconsciously give other people permission to do the same. As we are liberated from our own fear, our presence automatically liberates others.

~ Marianne Williamson

Case sensative join in SQL Server

ConfusedI ran into an interesting situation today while writing a query in Microsoft SQL Server’s query analyzer. I have a table with people’s information in it. One of the columns is blood type. In this column you have one of the following values: O,o,A,a,B,b,C,c. In another table I have a map of various ways of showing someone is O Negative. The main way we tend to show it is O- or O+ or A- or A+ etc. Well, when I joined the two tables and attempted to use one of the mapped columns to represent the blood type the number of records doubled.

What on earth is going on? After some playing I found that joining the tables was creating doubles because the query was seeing O the same as o (one being uppercase and one being lowercase.) It was ignoring the case of the values. Apparently there are some settings to make your SQL server case sensative or not case sensative when you install SQL Server. I don’t remember that part, but I wan’t about to go changing any settings and risk the other databases on the server freaking out and causing havok.

So after some Googling I found the following to do a case sensative join since my server is ignoring it:

Select blah, blah, blah
FROM Donor D left outer join abomap A on convert(binary(3),d.btype) = convert(binary(3),a.id)

The key is using the convert function to convert the blood types to binary which you end up with different values from an uppercase O and a lowercase o and your join turns out the way it should.

Pretty cool huh? Well, at least me and the gorilla did. :)