![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? Thanks. -- Craig |
#3
| |||
| |||
|
|
Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" <Craig (AT) discussions (DOT) microsoft.com> wrote in message news:Craig (AT) discussions (DOT) microsoft.com: I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? Thanks. -- Craig |
#4
| |||
| |||
|
|
No...as I mentioned...Cint does NOT work. -- Craig "Allan Mitchell" wrote: Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" <Craig (AT) discussions (DOT) microsoft.com> wrote in message news:Craig (AT) discussions (DOT) microsoft.com: I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? Thanks. -- Craig |
#5
| |||
| |||
|
|
Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" wrote I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? |
#6
| |||
| |||
|
|
Hi folks, "Allan Mitchell" wrote: Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" wrote I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? maybee I'm crazy, but when importing from a text file, why not simply use the datetime transform? That works for me all the time and is so easy to configure ;-) Helge |
#7
| |||
| |||
|
|
What do you mean by datetime transform...SQL will only recognize this format as a datetime if it has single quotes. Thanks dr "Helge C. Rutz" wrote: Hi folks, "Allan Mitchell" wrote: Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" wrote I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? maybee I'm crazy, but when importing from a text file, why not simply use the datetime transform? That works for me all the time and is so easy to configure ;-) Helge |
#8
| |||
| |||
|
|
What do you mean by datetime transform...SQL will only recognize this format as a datetime if it has single quotes. Thanks dr "Helge C. Rutz" wrote: Hi folks, "Allan Mitchell" wrote: Does this help at all. Formatting Character Data into Datetime fields (http://www.sqldts.com/default.aspx?249) Allan "Craig" wrote I am importing a text file with a date field in a non-standard date format: In other words, it's in YYYYMMDD, without quotes. I've been unsuccessful in using DTS transformation using the dateserial function. The dateserial function recognizes the YYYY portion as a string; however, this function requires it to be in an integer format. Using Cint, Cast, Convert have all been unsuccessful. Ex. DTSdestination("Billing_Date") = dateserial(a, b, c) a = left(DTSsource("001"), 4) b = substr(DTSsource("001"), 5, 2) c = right(DTSsource("001"), 2) Any suggestions? maybee I'm crazy, but when importing from a text file, why not simply use the datetime transform? That works for me all the time and is so easy to configure ;-) Helge |
![]() |
| Thread Tools | |
| Display Modes | |
| |