Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date comparison

Status
Not open for further replies.

skibascott

IS-IT--Management
Mar 18, 2004
82
US
I am trying to create a query that will pull all records that have not expired. I have a field called enddate, formatted mm/dd/yyyy. I need to compare this field to today's date and select all of the records that are less than or equal to the enddate. Is this possible? Here is my code:

Code:
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
  <sql:query client-side-xml="0">
    SELECT WatchDocLink.docnumber,WatchDocLink.watchnumber, WatchDocLink.enddate
    FROM WatchDocLink
    WHERE ????????????????????
    ORDER BY WatchDocLink.docnumber,WatchDocLink.watchnumber
    FOR XML AUTO
  </sql:query>
</ROOT>

Thank you.
 
SELECT WatchDocLink.docnumber,WatchDocLink.watchnumber, WatchDocLink.enddate
FROM WatchDocLink
WHERE CONVERT(Char,WatchDocLink.enddate,101) <=
CONVERT(Char,GetDate(),101)
ORDER BY WatchDocLink.docnumber,WatchDocLink.watchnumber


Thanks

J. Kusch
 

This didn't work for me.
The way I am testing this is as follows, I am creating an xml doc with this query and reading the data from the xml with javascript. When displaying the output in Internet Explorer, I get an object required error.

I am sure that this is not the kind of feedback you want, but I am totally new to this and do not know of another way to test the results.

I just know that when the WHERE statement is not included that I do get output consisting of every record.

I realize that this does not give you much to work with.
 
Code:
WHERE enddate < {some variable replacement syntax}

What is the variable replacement syntax for javascript or the XML parser? Maybe you'll have better luck asking your question in the javascript or xml or web development forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top