Re: How to get SQL Server GETDATE to return the same format as ASP Date()
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 01/07/05
- Next message: Travis Pupkin: "SQL Update question"
- Previous message: Drew: "How to get SQL Server GETDATE to return the same format as ASP Date()"
- In reply to: Drew: "How to get SQL Server GETDATE to return the same format as ASP Date()"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 7 Jan 2005 16:03:19 -0500
(a) Have ASP send a logical and unambiguous date format, e.g. YYYYMMDD
(b) Don't think about "trimming" datetime values, they are not strings! If
you have an index on your DATETIME column, your best bet is going to be:
DECLARE @dt SMALLDATETIME
SET @dt = '20050107'
SELECT cols
FROM tbl
WHERE DateGenerated >= @dt
AND DateGenerated < @dt
-- http://www.aspfaq.com/ (Reverse address to reply.) "Drew" <drew.laing@NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message news:uhW7GsP9EHA.1084@TK2MSFTNGP15.phx.gbl... > I have an ASP application which inserts 3 fields into a database. The 3 > fields are, Name, Dept and DateGenerated. The DateGenerated field is > populated by the VBScript function, Date(). I need to filter the results by > today's date, but can't figure out how to trim GETDATE() to match the date > format that is entered. The date format that is inserted looks like this, > 1/7/2005. > > Thanks, > Drew > >
- Next message: Travis Pupkin: "SQL Update question"
- Previous message: Drew: "How to get SQL Server GETDATE to return the same format as ASP Date()"
- In reply to: Drew: "How to get SQL Server GETDATE to return the same format as ASP Date()"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|