Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Dates comparison using DATEADD in SQL WHERE Clause

  Asked By: Varsha Gupta         Date: Apr 30, 2010      Category: Sharepoint      Views: 358
 

I've got a profile that I created that has a property called
Expiration Date, which is a date type. I'm trying to compare the
document's Expiration Date with a point in time
90 days from the present. Here is the query in my VB app:

sSQL = "SELECT ""DAV:creationdate"", ""urn:schemas-microsoft-
com:office:office#Effective Date"", ""urn:schemas-microsoft-
com:office:office#Expiration
Date"", ""DAV:displayname"", ""DAV:href"" "
sSQL = sSQL & "FROM SCOPE('DEEP TRAVERSAL
OF ""http://ntsloan01/environmental/documents/"" ') "
sSQL = sSQL & "WHERE ""DAV:contentclass"" = 'urn:content-
classes:Permit' "
sSQL = sSQL & "AND ""urn:schemas-microsoft-
com:office:office#Expiration Date"" >=DATEADD(DAY, 90, GETGMTDATE())"

This isn't working, however. I keeps erroring out, and it's because
of the last line of the SQL statement. Has anyone done something
similar that actually works?

Tagged:                

 

1 Answer Found

 
Answer #1       Answered By: Manan Kadu          Answered On: Apr 30, 2010       

replace GETGMTDATE() with GETDATE()

As far as I know, GETGMTDATE() is not a valid function.

 
Didn't find what you were looking for? Find more on Dates comparison using DATEADD in SQL WHERE Clause Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].