Saturday, February 25, 2012

c++ ole DB stack overflow during sql server compilation

hi,
when i execute :
CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;
rs.SetRows(100);
HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,
DBGUID_DBSQL, FALSE);

with a requete with length = 13000, it works perfectly
but when my requete length is 200000 (example : SELECT * FROM myTABLE
WHERE id_table IN("lot of number : more then 30000 number"))
i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)
and when i explore the IErrorInfo message, i have :
minor = 565 and the message is
source :Microsoft OLE DB Provider for SQL Server
serveur has made a stack overflow during compilation...

Is there a solution to extract to data ?
in a fast way ...

thanks in advance ...
Mike[posted and mailed, please reply in news]

michael (mmike74@.caramail.com) writes:
> when i execute :
> CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;
> rs.SetRows(100);
> HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,
> DBGUID_DBSQL, FALSE);
> with a requete with length = 13000, it works perfectly
> but when my requete length is 200000 (example : SELECT * FROM myTABLE
> WHERE id_table IN("lot of number : more then 30000 number"))
> i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)
> and when i explore the IErrorInfo message, i have :
> minor = 565 and the message is
> source :Microsoft OLE DB Provider for SQL Server
> serveur has made a stack overflow during compilation...

That sounds like there is a bug or limitation somewhere.

Anyway, SQL Server does not perform well with very long IN clauses.
It could take over 15 seconds just to compile that query.

Take a look at http://www.sommarskog.se/arrays-in-sql.html for alternative
methods to pose the query.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment