04-08-2011 01:08 PM
LabVIEW 8.6 Professional with Data Connectivity Toolkit 1.0.2. SQL database is a flat (non-linked) table on an IBM SQL server.
I'm using the 'Complete SQL Session.vi' to search for records with a particular date stamp. This information is used to update tally displays on a factory floor.
The SQL statement for example is: SELECT * FROM TestResults WHERE Date_Test LIKE '%4/8/2011%';
If the SQL table column Date_Test was created using the Text Data Type (MS Access), I have no problems. However, if the same column in a different table was created using the Date/Time Data Type (MS Access), it won't return any records. I can change the SQL statement to read: WHERE Date_Test LIKE '%2011%'; It will return all the records for the entire year.
Has anyone run across this problem before, and found a workaround for it?
04-13-2011 12:03 AM
Greetings b.headley!
Would the following example be of any help in your situation?
DataBase: Gathering Information in a Specific Date/Time Range
http://decibel.ni.com/content/docs/DOC-4932
Michael G
04-13-2011 05:48 PM
Michael,
Thanks for pointing the app note, unfortunately I'm not able to open the example (written in LV 2009, I have LV 8.6).
Using the description as a guide, I tried using the 'Complete SQL Session.vi' again, but using the BETWEEN statement instead of the LIKE or comparative statements. Lo and behold, it worked!
An example 'working' statement read:
SELECT * FROM Test_Results WHERE Date_Test BETWEEN '04/13/2011 00:00' AND '04/13/2011 23:59';
Thanks for the assist - it's truely appreciated!
05-25-2012 07:57 AM
Was struggling with this issue the past day, this was what I needed. I won't have to pull anymore of my hair out thanks to this post.