Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

ASP / SQL Server date range

Posted 20 Apr 2005 15:56:16
1
has voted
20 Apr 2005 15:56:16 adam partridge posted:
i have a news page that i want to display articles dependant on wether a set expirey date has passed. how would i do this with SQL server and ASP im thinking :

"SELECT intid, strauthor, dtdateexpires FROM dbo.tblnews WHERE dtdateexpires <= '" + now() + "'"

do i need to put #'s in there or would this work.. also would this return rows that dont have an expirery date ?

Replies

Replied 20 Apr 2005 20:00:10
20 Apr 2005 20:00:10 Chris Charlton replied:
Sounds like you haven't even tried the query. Poke and see, as it seeeeems right at first glance.

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 20 Apr 2005 20:50:25
20 Apr 2005 20:50:25 adam partridge replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Sounds like you haven't even tried the query. Poke and see, as it seeeeems right at first glance.

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

finally worked it out i used :

SELECT intid, dtdateexpires, strnewstitle
FROM dbo.tblnews
WHERE dtdateexpires &lt; GetDate() OR dtdateexpires IS NULL
ORDER BY dtdate DESC

just incase anyone else has a similar query

Reply to this topic