LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL script with Access: A script with a wilcard *

We are using ACCESS 2007.

 

I am not able to use the wildcard(*) in my script:

Exemple:

sprintf(myQRY,"SELECT tablename.col1 FROM table.name WHERE tablename.col1 Like '%s' ",mystring); mystring="aa*"

 

tablename.col1

aa000001

aa000002

bb000001 

 

The result I expect is: aa00001, aa00002

 

I get no records: It seems that the wildcard * is not recognize. I tryied %,_ still doesn't work: When I try myQRY in ACCESS it works. 

 

Do you have an exemple using the wildcard

0 Kudos
Message 1 of 3
(3,626 Views)

JTTest1997,

 

You could try to use this command: 

 

SELECT tablename.col1 FROM table.name WHERE tablename.col1 Like ´aa*´

 

Please take a look to this page.

 

 

0 Kudos
Message 2 of 3
(3,602 Views)

 

DataHandle1 = DBConnect ("DSN=MANUF");
sprintf(StrQry, "SELECT Box_Number,Closed FROM tblBOX WHERE (((tblBOX.Box_Number) Like '*'));");

StatHandle1 = DBActivateSQL (DataHandle1,StrQry);
numRec = DBNumberOfRecords (StatHandle1);

 

Still doesn`t work. Even if have data in the tblBOX.Box_Number, I get numRec=0.

 

It seems that it interpret the * as a caractere instead of a wildcard

 

An I am connected to the right tblBox table because I am able to add data  to the tblBOX.Box_Number column

0 Kudos
Message 3 of 3
(3,580 Views)