Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SYNTAX TO CONVERT STRING DATE TO DATETIME

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
US
As part of a DTSPackage, inside an ActiveXScript element, I need to convert a string date, formatted as YYYYMMDD to a datetime format for loading into a SQLServer table. I am falling short when I try to use CAST or CONVERT.

Thanks in advance.
 
As you posted in the VBScript forum:
oldValue = "YYYYMMDD"
newValue = "'" & Left(oldValue, 4) & "-" & Mid(oldValue, 5, 2) & "-" & Right(oldValue, 2) & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top