dbTalk Databases Forums  

Extracting "today's" data

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Extracting "today's" data in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dhamric
 
Posts: n/a

Default Extracting "today's" data - 05-03-2006 , 01:42 PM






I'm trying to extract data from a table based on Today's Date using DTS.
This job will run nightly and pull data from the five fields mentioned for
that day and move it to another sql database on a different server.

I'm not a programmer and am having difficulty getting it to grab the data.
I have been able to do this in the past and it worked, but now it does not.
When I take out the "where" statement, it pulls all data. I only need data
for today. If anyone has any advice on any modifications on the script
below, i would appreciate it.

SELECT AccountName, TrxEndTime, TotalPieces,
TotalChargedwithsurcharges, UserDefinedField
FROM [mntrans].[dbo].[vwTransactiondataForCustomReports]
WHERE TrxEndTime=dateadd (day, DATEDIFF (day, 0, getdate() ), 0)
AND TrxEndTime < DATEADD (day, DATEDIFF (day, 0, getdate() ), 1)
ORDER BY AccountName, TrxEndTime, TotalPieces, TotalChargedwithsurcharges,
UserDefinedField

Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Extracting "today's" data - 05-03-2006 , 09:30 PM






Try something like the following:

where TrxEndTime >= convert(varchar(8),GetDate(),112)
And TrxEndTime <
dateadd(dd,1,convert(varchar(8),GetDate(),112))

-Sue

On Wed, 3 May 2006 11:42:02 -0700, dhamric
<dhamric (AT) discussions (DOT) microsoft.com> wrote:

Quote:
I'm trying to extract data from a table based on Today's Date using DTS.
This job will run nightly and pull data from the five fields mentioned for
that day and move it to another sql database on a different server.

I'm not a programmer and am having difficulty getting it to grab the data.
I have been able to do this in the past and it worked, but now it does not.
When I take out the "where" statement, it pulls all data. I only need data
for today. If anyone has any advice on any modifications on the script
below, i would appreciate it.

SELECT AccountName, TrxEndTime, TotalPieces,
TotalChargedwithsurcharges, UserDefinedField
FROM [mntrans].[dbo].[vwTransactiondataForCustomReports]
WHERE TrxEndTime=dateadd (day, DATEDIFF (day, 0, getdate() ), 0)
AND TrxEndTime < DATEADD (day, DATEDIFF (day, 0, getdate() ), 1)
ORDER BY AccountName, TrxEndTime, TotalPieces, TotalChargedwithsurcharges,
UserDefinedField


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.