locked
Windows Search - SQL Queries RRS feed

  • Question

  • Hi,

    i am using ISearchQueryHelper interface for searching the winodws files programmatically.

    I would like to search of teh files which are modifed within a day, week or month etc....

    "SELECT \"System.ItemPathDisplay\" FROM \"SystemIndex\" WHERE CONTAINS(*,'\"error*\"',1033) AND scope='file:C:\\Users\\dhanusks\\Desktop\\santhi-zip' AND ( System.FileName LIKE '%.%'  OR System.FileExtension LIKE '%.%' OR  System.FileName LIKE '%.log'  OR System.FileExtension LIKE '%.log' OR  System.FileName LIKE '%.txt'  OR System.FileExtension LIKE '%.txt' OR  System.FileName LIKE '%.err'  OR System.FileExtension LIKE '%.err' ) AND System.ItemDate > GETDATE()-7 ORDER BY System.ItemPathDisplay ASC"

    when I use getdate(), this query is failing and throwing errors. But If I hardcode a date as a string like '2012-08-08 02:23:45', it works fine.

    why getdate() is not working?

    Wednesday, August 8, 2012 10:33 AM