I'm not sure if this would entirely solve your problem, but can you use
"Starting with".

Apparently this is what the fb db engine maps "Like" to internally since
Starting with will use an available index and Like not.

Rick

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
stephane
Sent: Thursday, October 25, 2007 5:28 AM
To: [email protected]
Subject: [Firebird-net-provider] Problem with LIKE predicate. (parameter
overflow)

Hello,

please consider the following query :

SELECT *
FROM Customers
WHERE Name LIKE @param1

And suppose that Customers.Name column datatype is CHAR(4)

-------------------
now, here's the C# code snippet used :

FbCommand fb = conex.CreateCommand();
fb.CommandText = "SELECT * FROM Customers WHERE Name LIKE @param1" ;

fb.Parameters.Add("@param1", "JOHN%");

-------------------

The execution of query fails because it's considered "arithmetic overflow /
string truncation". 

"JOHN%" string length is 5, which is bigger than 4 so it's considered
wrong...
but the resulting query would be entirely VALID! Same would happend if you
use
other combination of wildcards in the LIKE expression, for example "JOH^T" (
"JOH" and not "T").

If someone could give me an hint or a solution to this problem it would be
greatly appreciated because it's critical for my app. This is very serious.

Thanks in advance.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to