dbTalk Databases Forums  

Date Add Operation

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


Discuss Date Add Operation in the microsoft.public.sqlserver.dts forum.



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

Default Date Add Operation - 05-03-2005 , 11:03 AM






Hi,

I want to add a variable on a datetime, i try this :
**********************************************
Option Explicit
Function Main()
dim ctps
dim duree

ctps = DTSSource("dtstempsdeb").Value
duree = DTSSource("dtscallduration").Value

DTSDestination("ctemps").Value = ctps.Add(duree)
Main = DTSTransformStat_OK
End Function
*********************************************
DTSSource("dtstempsdeb") as datetime
DTSSource("dtscallduration") as int
DTSDestination("ctemps") as datetime

But it returns => " Object require 'ctps' "

It's a simple VBscript so what's wrong ?

Rgds
Flora.










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

Default RE: Date Add Operation - 05-03-2005 , 11:10 AM






Hi
In your example
ctps and duree are treated as variants as per the decleration.

thats the reason, ctps.Add(duree) is not permitted.

regards,
Chandra



"Flora Pho" wrote:

Quote:
Hi,

I want to add a variable on a datetime, i try this :
**********************************************
Option Explicit
Function Main()
dim ctps
dim duree

ctps = DTSSource("dtstempsdeb").Value
duree = DTSSource("dtscallduration").Value

DTSDestination("ctemps").Value = ctps.Add(duree)
Main = DTSTransformStat_OK
End Function
*********************************************
DTSSource("dtstempsdeb") as datetime
DTSSource("dtscallduration") as int
DTSDestination("ctemps") as datetime

But it returns => " Object require 'ctps' "

It's a simple VBscript so what's wrong ?

Rgds
Flora.










Reply With Quote
  #3  
Old   
Flora Pho
 
Posts: n/a

Default RE: Date Add Operation - 05-03-2005 , 11:58 AM



This alternative seems to be false too :

Function Main()
DTSDestination("ctemps") = DTSSource("dtstempsdeb").AddSeconds
(DTSSource("dtscallduration"))
Main = DTSTransformStat_OK
End Function

AddSeconds method is not treated
So have you a suggestion ?

"Chandra" wrote:

Quote:
Hi
In your example
ctps and duree are treated as variants as per the decleration.

thats the reason, ctps.Add(duree) is not permitted.

regards,
Chandra



"Flora Pho" wrote:

Hi,

I want to add a variable on a datetime, i try this :
**********************************************
Option Explicit
Function Main()
dim ctps
dim duree

ctps = DTSSource("dtstempsdeb").Value
duree = DTSSource("dtscallduration").Value

DTSDestination("ctemps").Value = ctps.Add(duree)
Main = DTSTransformStat_OK
End Function
*********************************************
DTSSource("dtstempsdeb") as datetime
DTSSource("dtscallduration") as int
DTSDestination("ctemps") as datetime

But it returns => " Object require 'ctps' "

It's a simple VBscript so what's wrong ?

Rgds
Flora.










Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Date Add Operation - 05-03-2005 , 02:23 PM



What about

DATEADD("s",Cint(DTSSource("dtscallduration")),CDa te(DTSSource("dtstempsdeb")))




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Flora Pho" <FloraPho (AT) discussions (DOT) microsoft.com> wrote

Quote:
This alternative seems to be false too :

Function Main()
DTSDestination("ctemps") = DTSSource("dtstempsdeb").AddSeconds
(DTSSource("dtscallduration"))
Main = DTSTransformStat_OK
End Function

AddSeconds method is not treated
So have you a suggestion ?

"Chandra" wrote:

Hi
In your example
ctps and duree are treated as variants as per the decleration.

thats the reason, ctps.Add(duree) is not permitted.

regards,
Chandra



"Flora Pho" wrote:

Hi,

I want to add a variable on a datetime, i try this :
**********************************************
Option Explicit
Function Main()
dim ctps
dim duree

ctps = DTSSource("dtstempsdeb").Value
duree = DTSSource("dtscallduration").Value

DTSDestination("ctemps").Value = ctps.Add(duree)
Main = DTSTransformStat_OK
End Function
*********************************************
DTSSource("dtstempsdeb") as datetime
DTSSource("dtscallduration") as int
DTSDestination("ctemps") as datetime

But it returns => " Object require 'ctps' "

It's a simple VBscript so what's wrong ?

Rgds
Flora.












Reply With Quote
  #5  
Old   
Flora Pho
 
Posts: n/a

Default Re: Date Add Operation - 05-04-2005 , 04:01 AM



Hi,

It's exactly what I want
You're great Allan, thx a lot again

"Allan Mitchell" wrote:

Quote:
What about

DATEADD("s",Cint(DTSSource("dtscallduration")),CDa te(DTSSource("dtstempsdeb")))




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Flora Pho" <FloraPho (AT) discussions (DOT) microsoft.com> wrote

This alternative seems to be false too :

Function Main()
DTSDestination("ctemps") = DTSSource("dtstempsdeb").AddSeconds
(DTSSource("dtscallduration"))
Main = DTSTransformStat_OK
End Function

AddSeconds method is not treated
So have you a suggestion ?

"Chandra" wrote:

Hi
In your example
ctps and duree are treated as variants as per the decleration.

thats the reason, ctps.Add(duree) is not permitted.

regards,
Chandra



"Flora Pho" wrote:

Hi,

I want to add a variable on a datetime, i try this :
**********************************************
Option Explicit
Function Main()
dim ctps
dim duree

ctps = DTSSource("dtstempsdeb").Value
duree = DTSSource("dtscallduration").Value

DTSDestination("ctemps").Value = ctps.Add(duree)
Main = DTSTransformStat_OK
End Function
*********************************************
DTSSource("dtstempsdeb") as datetime
DTSSource("dtscallduration") as int
DTSDestination("ctemps") as datetime

But it returns => " Object require 'ctps' "

It's a simple VBscript so what's wrong ?

Rgds
Flora.













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.