Viewing 15 posts - 13,006 through 13,020 (of 26,486 total)
caramelkaps (4/10/2012)
We have a very time sensitive pressing requirements to be addressed immediately.
We need to read the date time column from sql server into oracle 10g.
We have a dblink established...
April 10, 2012 at 1:02 pm
Try replacing your date filter with this:
AND (IND2.DEMAND_DATE >= dateadd(mm, datediff(mm, 0, getdate()) - 2, 0) AND IND2.DEMAND_DATE < dateadd(mm, datediff(mm, 0, getdate()) - 1, 0))
April 10, 2012 at 12:58 pm
Your BETWEEN will not work.
select DATEADD(month,-2,DATEADD(D, -1, DATEADD(M,DATEDIFF(M,0,GETDATE())+1,0))) , DATEADD(month,-2,DATEADD(DD, 1 - DAY(GETDATE()), GETDATE()))
Results:
2012-02-29 00:00:00.000 2012-02-01 12:53:59.663
The first date is greater than the second.
April 10, 2012 at 12:55 pm
Looking at the dates you tried to calculate, I'd say you are looking for the start and end for 2 months ago.
Here is some code to help you:
declare @ThisDate datetime,
...
April 10, 2012 at 12:44 pm
Looking at the code you did post, you'd get nothing in return any way. It looks like the first date is > the second date. Using BETWEEN the...
April 10, 2012 at 12:39 pm
twdavis-893252 (4/10/2012)
DATEADD(month,-3,DATEADD(D, -1, DATEADD(M,DATEDIFF(M,0,GETDATE())+1,0)))
for use in a between statment like
DEMAND_DATE BETWEEN DATEADD(month,-2,DATEADD(D, -1, DATEADD(M,DATEDIFF(M,0,GETDATE())+1,0)))
AND DATEADD(month,-2,DATEADD(DD, 1 - DAY(GETDATE()),...
April 10, 2012 at 12:35 pm
ColdCoffee (4/10/2012)
Why i say this, SQL needs to just to wrap...
April 10, 2012 at 12:21 pm
Siva Ramasamy (4/10/2012)
this is great...exactly what I wanted..thanks so much..Let me understand your code...if I have any questions, I will ask you.
Thanks so much again!!!
-Siva.
Let us know if you get...
April 10, 2012 at 12:06 pm
Edit: --- Ignore, doesn't work (yet) ----
Here is my shot at the code:
select
substring(convert(varchar(24), dateadd(mm,datediff(mm,0,datefield),0), 113),4,8), count(*)
from
dbo.MyTable
group by
dateadd(mm,datediff(mm,0,datefield),0)
order...
April 10, 2012 at 11:52 am
Siva Ramasamy (4/10/2012)
Hi,Thanks for your reply..
I just got this question...and have started googling...no solutions yet..
But I need to solve it in ASAP.. 🙂
Thanks!
Siva.
Interview question?
April 10, 2012 at 11:44 am
Care to post what you have tried so far?
April 10, 2012 at 11:40 am
SQLRNNR (4/10/2012)
Lynn Pettis (4/10/2012)
long-haulu-haul
later!
April 10, 2012 at 11:24 am
Please don't double post. Most people that answer these forums use the Active Threads view to see what is currently being posted. In addition it fragments any responses...
April 10, 2012 at 10:54 am
Viewing 15 posts - 13,006 through 13,020 (of 26,486 total)