dbTalk Databases Forums  

DTS - Extracting SQL data based on a Date

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


Discuss DTS - Extracting SQL data based on a Date in the microsoft.public.sqlserver.dts forum.



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

Default DTS - Extracting SQL data based on a Date - 07-01-2008 , 02:58 PM






SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.


Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger

Reply With Quote
  #2  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM






On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #3  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #4  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #5  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #6  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #7  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #8  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


Reply With Quote
  #9  
Old   
matteus
 
Posts: n/a

Default Re: DTS - Extracting SQL data based on a Date - 07-02-2008 , 02:43 AM



On Jul 1, 9:58 pm, robboll <robb... (AT) hotmail (DOT) com> wrote:
Quote:
SQL Server 2000 -- DTS Package Fails with error: Invalid procedure
call or argument 'DATEDIFF'. This works in a view. Is there a
better way to do this?

What I am trying to do is transfer only yesterdays data (i.e., Now()
-1) to a delimited text file.

Function Main()

IF (DATEADD(dd, 0, DATEDIFF(dd, 0, ServerTimeStamp)) = DATEADD(dd, 0,
DATEDIFF(dd, 0, NOW())) - 1) THEN
DTSDestination("ID") = DTSSource("ID")
DTSDestination("Direction") = DTSSource("Direction")
DTSDestination("ServerTimeStamp") = DTSSource("ServerTimeStamp")
DTSDestination("Quality") = DTSSource("Quality")
DTSDestination("Agency") = DTSSource("Agency")
DTSDestination("LoggedOn") = DTSSource("LoggedOn")
Main = DTSTransformStat_OK
ELSE
Main = DTSTransformStat_SkipRow
END IF
End Function

Thank you for any help with this.

RBollinger
The error message is quite clear: Wrong datediff syntax.
Open a web browser, type www.google.it in the address bar, click
enter, type "dateadd visualbasic" and click i feel lucky...

PS: Why don't you use an easier execute sql task with sth like:
INSERT INTO TargetTable
SELECT * FROM SourceTable
WHERE yourDate = DATEADD(d, -1, GETDATE())


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.