If a driver supports SQLDescribeParam, I can ask for the correct data type when binding the parameter. Otherwise I used to choose SQLCHAR is the default. This worked until SQL Server 2005 (I think) when I found it would fail for binary columns.
Since a lot of drivers don't support SQLDescribeParam, is there a way to reliably bind a NULL parameter without it?
If not, here are a couple of solutions for making this possible. After all, getting more people (even on Linux using FreeTDS) using SQL Server is in Microsoft's interest.
1) The ideal would be to have SQL Server not care about the data type when a value is NULL. After all, it is going to discover the final data type an a NULL for any data type should be convertible to a NULL in any other type.
2) Document how FreeTDS can implement SQLDescribeParam so OS/X and Linux users can connect to SQL Server.