Problems Migrating Between MySQL and MSSQL

I posted this under "FactoryPMI Problems but then realized it might be better suited under this heading.

I am having a problem with migrating all my forms and SQL queries from MySQL to MSSQL. The code for the script that is excuted whenever I want to try and open a CSV file is in the attached file. I do not think my syntax is wrong between MySQL and MSSQL but maybe it is because the script works perfectly when pointed at the MySQL database. Thanks for your help!

Ha, and I replied there before seeing this one. Check out the reply HERE