I need to use an old school ADODB (not ADO.NET) to execute a statement containing a Common Table expression. I use (should use) the SQLOLEDB provider. The DML operator works great when working with a Windows 7 / Windows Server 2008 client, but not from a WinXP or Win2K3 server. I profiled the procedure and found that older OSs send a slightly different SQL statement.
Win7 + 2008 = exec sp_executesql N'WITH source(Vsl, Cpt, SrcTyp, SrcNum, Opn, JobNum, Qty, Cst, Vry, Reg, Vnt, Sbk) AS ...' WinXP + Win2K3 = exec sp_executesql N'exec WITH source(Vsl, Cpt, SrcTyp, SrcNum, Opn, JobNum, Qty, Cst, Vry, Reg, Vnt, Sbk) AS ...'
Note that an additional "exec" has leaked into the command text.
It seems that versions of SQLOLEDB.1 on older operating systems do not correctly handle the WITH statement and see that it needs a preliminary "exec".
Can someone shed some light on this. Is there an SQLOLEDB driver update that I can apply to older OS? or some other workaround.
source share