using "LIKE" with a date in ms-sql question

Results 1 to 2 of 2

Thread: using "LIKE" with a date in ms-sql question

  1. #1
    Join Date
    Dec 1969

    Default using "LIKE" with a date in ms-sql question

    I&#039;m stumped on this one. I have a database of historical facts spanning years and I want to have a &#039;today in history&#039; type page. I developed the asp/database using MS-Access and discovered I can do this by by using the string.<BR><BR>SELECT * <BR>FROM Dates <BR>WHERE tdate LIKE &#039;%10/10/%&#039; ORDER BY tdate desc <BR><BR>and it will return the dates 10/10/1971, 10/10/1982, 10/10/91 etc. You get the idea.<BR><BR>I converted it over to MS-SQL 7 and it will not work anymore. It just pulls up blank. I checked the docs with MS-SQL and it&#039;s states the above should work. I suspect it&#039;s a syntax error on my part.<BR><BR>Any help would be appreciated.<BR><BR>Pete

  2. #2
    Join Date
    Dec 1969

    Default Making it way too hard!

    WHERE Month(tdate) = Month(getDate()) AND Day(tdate) = Day(getDate())<BR><BR>Presto. No VBS needed to put the month or day numbers in, even!<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts