Rusty Well-Known Member Licensed User Longtime User Feb 3, 2013 #1 For the past year or so, I've been using: SELECT * FROM WHERE [FirstName] LIKE 'Pe%' this used to select rows where FirstName STARTED with Pe (case insensitive) Recently, this no longer works. (not sure why) The result of the query is NO rows selected. (I've verified that multiple rows have a FirstName beginning with Pe like Pete, Peter, Pedro...) Now, I've been trying: SELECT * FROM WHERE [FirstName] LIKE '%Pe%' This "works", but it returns rows that contain Pe, but it also returns any row where "Pe" (case insensitive) occurs anywhere within the FirstName column. This insures me that the data is there; the database is (likely) not corrupted, but the results are not what I want. I only want Rows that the FirstName BEGINS with "Pe". I don't know what has changed. Any Ideas what I might be doing wrong? Thanks, Rusty
For the past year or so, I've been using: SELECT * FROM WHERE [FirstName] LIKE 'Pe%' this used to select rows where FirstName STARTED with Pe (case insensitive) Recently, this no longer works. (not sure why) The result of the query is NO rows selected. (I've verified that multiple rows have a FirstName beginning with Pe like Pete, Peter, Pedro...) Now, I've been trying: SELECT * FROM WHERE [FirstName] LIKE '%Pe%' This "works", but it returns rows that contain Pe, but it also returns any row where "Pe" (case insensitive) occurs anywhere within the FirstName column. This insures me that the data is there; the database is (likely) not corrupted, but the results are not what I want. I only want Rows that the FirstName BEGINS with "Pe". I don't know what has changed. Any Ideas what I might be doing wrong? Thanks, Rusty
M Mahares Expert Licensed User Longtime User Feb 3, 2013 #2 On the surface your code looks correct. But, try this. It works for me: Code: Copy Dim txt as string txt="SELECT * FROM MyTable WHERE FirstName LIKE ? " Cursor1=SQL1.ExecQuery2(txt,Array As String("Pe%")) Upvote 0
On the surface your code looks correct. But, try this. It works for me: Code: Copy Dim txt as string txt="SELECT * FROM MyTable WHERE FirstName LIKE ? " Cursor1=SQL1.ExecQuery2(txt,Array As String("Pe%"))
Rusty Well-Known Member Licensed User Longtime User Feb 3, 2013 #3 Thanks for the suggestion. I implemented your suggestion with the same results. Rusty Upvote 0
mc73 Well-Known Member Licensed User Longtime User Feb 3, 2013 #4 tried checking the length of the returned strings? perhaps it can be a leading character, put at the import or insertion. Upvote 0
tried checking the length of the returned strings? perhaps it can be a leading character, put at the import or insertion.