navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Get yesterday's date using SQL

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Get yesterday's date using SQL
Page: [1]
 
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
Get yesterday's date using SQL - 7/20/2005 11:37:43   
Can anyone tell me how to get yesterday's date in SQL. I thought it was sysdate - 1, but that doesn't seem to work.
BeTheBall

 

Posts: 6355
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Get yesterday's date using SQL - 7/20/2005 11:54:51   
Is is getdate -1?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rrnml)
BeTheBall

 

Posts: 6355
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Get yesterday's date using SQL - 7/20/2005 12:08:54   
You may need to use the DateAdd function. Something like:

DateAdd("d", -1, getdate)

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to BeTheBall)
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
RE: Get yesterday's date using SQL - 7/20/2005 12:39:03   
I tried your suggestion and I get an error that says...

Microsoft Access

ADO Error: Invalid parameter 1 specified for dateadd.

When I run it, instead of "d", it forces @d in the code. Any ideas?

(in reply to BeTheBall)
BeTheBall

 

Posts: 6355
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Get yesterday's date using SQL - 7/20/2005 13:00:35   
quote:

Can anyone tell me how to get yesterday's date in SQL.


Ahh. You threw me a curveball. You said "in SQL," but according to your error, you are using Access. So I guess you meant in the SQL statement.

Try this instead:

DateAdd('d', -1, date())

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rrnml)
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
RE: Get yesterday's date using SQL - 7/20/2005 18:51:07   
Thanks for your help. We ended up using DATEADD(d, - 1, { fn CURDATE() }) Found it in the Transact SQL Scalar Functions for Expressions. My co-worker didn't explain that it was an SQL db with an Access adp for the front end. We're using this function in a stored procedure to automate it so we'll see if it works in the morning. If not, I'll be back. Thanks again.

(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Get yesterday's date using SQL
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts