Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Dates comparison using DATEADD in SQL WHERE Clause

  Asked By: Varsha    Date: Apr 30    Category: Sharepoint    Views: 1858

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?

Share: 

 

1 Answer Found

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

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.




Tagged: