If you try to use the WITH clause in a SQL Command of an OLE DB Source in a Data Flow of Integration Services, you might receive the error ‘Statement(s) could not be prepared’.

Solution: put a semicolon (;) just before the WITH keyword.

 

Originally appeared on: http://sqlblog.com/blogs/marco_russo/archive/2009/04/10/use-of-the-with-clause-in-sql-command-ssis-oledb-source.aspx