Is there anyway to use the LIKE function on a date field? I have a web form where the user can input a date to query (or partial date). I was hoping the user could enter something like '%/3/2005' which would return all matching records. However, LIKE does not work on a text field. I have got it somewhat working by using the following convert on the field before I do the like comparison:
CONVERT (NVARCHAR, field_name, 101)
The only problem with this is that it changes the date to text in mm/dd/yyyy format. If the user were to do a search on '%/3/2005', then this would not return any matches. The user would need to enter '%/03/2005'.
Any ideas would be appreciated.
CONVERT (NVARCHAR, field_name, 101)
The only problem with this is that it changes the date to text in mm/dd/yyyy format. If the user were to do a search on '%/3/2005', then this would not return any matches. The user would need to enter '%/03/2005'.
Any ideas would be appreciated.