Using datetime tags in an SQL Query

I am trying to write a DB query to pull data based on a field value between two datetimes. I’m pulling the criteria datetime values from two datetime tags. I keep getting errors and can’t seem to hit the right combination of delimiters to identify the tag values as dates. See below:
[attachment=1]Screen Shot 05-09-14 at 08.17 AM.PNG[/attachment]

And another attempt:
[attachment=0]Screen Shot 05-09-14 at 08.19 AM.PNG[/attachment]

Any insight into the proper syntax or otherwise what I’m missing would be greatly appreciated.

David

The Database Query Browser cannot reference tags like that. It just send text to the SQL Server (parsed by Ignition a little, such as to limit the number of records returned). To test this, create a Table component in a test window and set the binding of the Table.data to SQL Query and then paste this in. (Use the single quote syntax.)