Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
The code below works fine but if we use a 4 digit year it fails !The error we get is data overflow invalid cast etc, we are SQL2000So what I am saying is that if I change iyear = right(DTSSource("clindate"),2)to iyear = right(DTSSource("clindate"),4)it fails !Dim iDayDim imonthDim iyearDim dDateFunction Main() iday = left(DTSSource("clindate"),2) imonth = mid(DTSSource("clindate"),4,2) iyear = right(DTSSource("clindate"),2) dDAte = (iMonth + "/" + iday + "/" + iYear) if isdate(dDate)<>True then Main = DTSTransformStat_SkipRow Else DTSDestination("Clinic_Date") =dDate Main = DTSTransformStat_OK end ifEnd Function
RickD
Slow But Sure Yak Herding Master
3608 Posts
Posted - 2006-02-07 : 07:13:14
What is in clindate?Output the result and I bet you are getting a 2 digit year..
DaveRolph
Starting Member
15 Posts
Posted - 2006-02-07 : 12:52:47
If I output the clindate as a string I get DD/MM/YYYY !
RickD
Slow But Sure Yak Herding Master
3608 Posts
Posted - 2006-02-08 : 05:18:25
And it works if you only take 2 from the right?!?Oh btw, Where are you setting tDate as it doesn't seem to be set here?
DaveRolph
Starting Member
15 Posts
Posted - 2006-02-08 : 06:59:23
RickYeah it works if I take 2 but not 4, I cut the code down tDate should be dDate Sorry I corrected the post now
RickD
Slow But Sure Yak Herding Master
3608 Posts
Posted - 2006-02-08 : 08:00:19
What about if you change
iyear = right(DTSSource("clindate"),2)
to
iyear = mid(DTSSource("clindate"),7,4)
DaveRolph
Starting Member
15 Posts
Posted - 2006-02-18 : 05:12:49
RickI have moved onyo another project now but passed your suggestion on to the guy who is working on this one, I have told him to post up his findings here.Thanks for the help.