NIce hack!
I wish I had known about this last week when I discovered the problem and nearly died of freight! I was close to a big delivery and had to find a solution.
Your solution is much better and I have changed my code to use it. Thanks.
Jonathon, perhaps you could help me with another problem I have had relating to MSSQL and convert?
I want to use a timestamp in a "where" clause to implement optimistic locking from PHP. I want to use an query like "update t1 ... where timestamp='$oldts'". Although PHP appears to have a reasonable hex string for timestamp value, this never works.
I have tried "..where timestamp='0x$oldts'" and that fails also.
Finally, I tried using convert(timestamp, '$oldts') but that fails too.
Do you have any idea about how to pass a timestamp back to a query from PHP?