Ticket #7600

I've posted a patch plus associated test that fixes this ticket. Just want to make the sql server adapter guys aware so we potentially get this pushed into the core.