Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSSQL Server Error 241
Message
From
26/06/1998 12:04:23
Bob Lucas
The WordWare Agency
Alberta, Canada
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00111752
Message ID:
00111951
Views:
14
>Hi John, at sometime I would like to use the % as a wildcard to pickup all dates if when I need to. Also, I have intentionally set lddate to "%". Thanks for your help.

LIKE and % do matching based on strings. This is not going to work with a date field the same as it wouldn't work with a numeric. In fact, you need to consider datetime fields as a kind of numeric. Sometimes they are really awful to work with, especially when you are doing searches on say a last modified field that can have any time component.

The best I can suggest is to change the comparison from a date field to a character field. This may not give you what you want, but you can do this:

SELECT *
FROM dbo.test TEST
WHERE CONVERT(CHAR(20), test.date1, 112) = ?v_date

where v_date has some STRING value that can match the convert string

or

SELECT *
FROM dbo.test TEST
WHERE CONVERT(CHAR(20), test.date1, 112) Like ?v_date

where v_date is also some string date with a % also embedded within.

v_date is your parameter field that is passed to ODBC (where the substitution is made prior to sending the query to SQL Server.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform