it will give you output = 2003-12-12 16:24:07.077
So time is current not 00:00:00
Main Topics
Browse All TopicsWould like one simple sql query which will return me result of yesterday date.
If I use getdate() -1 -- it will gives me result from cuurent time -1 but I would like result from 00:00 AM.
I'm Not doing schedule at 00:00 AM as I'll get data after 1AM.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I often need a function which return me clear date in stored procedures,views and functions so I wrote one I use in all my projects: as you see there ara two parameters:startDate as datetime, and daysToAdd, If you enter only first parameters, startDate will be clear date.
It will work in SQL2000
ALTER FUNCTION dbo.fn_GetDate
(
@startDate datetime,
@daysToAdd int=0
)
RETURNS datetime
AS
BEGIN
declare @pom int
declare @myDate datetime
set @myDate=dateadd(yyyy,year(
set @myDate=dateadd(mm,Month(@
set @myDate=dateadd(dd,Day(@st
RETURN @myDate
END
Business Accounts
Answer for Membership
by: namasi_navaretnamPosted on 2003-12-13 at 08:14:04ID: 9934442
DATEADD ( datepart , number, date )
Select (dd, -1, GetDate()) as PreviousDay
HTH