LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL 'SELECT' statement

I use LV7.1.1 to read/update an Access Database, using DB Toolset.
When I use the Sql 'SELECT' query with LIKE operator, I do not get any results. (no error is returned).
The statement is:
SELECT Machine, System, AD, Query_Position, RefDesignator, Description
FROM AllLevel
WHERE ((Machine LIKE '*')  AND (System  LIKE '*')  AND (AD ='2000CV20012') AND (Query_Position ='AD') AND (RefDesignator='u1'))
It seems that the LIKE '*' is not translated well by the 'Microsoft Jet 4.0 OLE DB Provider'. I must mention that the statement works just fine under Access, not using LV.
Is there any alternative format for LIKE '*' that do the job?
 
Regards,
Joseph Moshe
0 Kudos
Message 1 of 3
(2,688 Views)
Maybe Access has different syntax, but for T-SQL, the proper syntax for LIKE is to use the % character to match any string of zero or more characters and the _ character to match a single characer. In fact, the documentation says that while * and ? are understood,
"The % and _ (underscore) wildcard characters should be used only through the Jet OLE DB provider and ActiveX® Data Objects (ADO) code. They will be treated as literal characters if they are used though the Access SQL View user interface or Data Access Objects (DAO) code."
0 Kudos
Message 2 of 3
(2,681 Views)
Thank you! It solved the problem!
0 Kudos
Message 3 of 3
(2,675 Views)