Date conversion to SQL server

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Post by shilpa79 »

DSguru2B wrote:Try changing it. Also, since this is such a struggle, load it to a flat file, just a few records to see how it looks like. It should have two parts. The first is date in the format YYYY-MM-DD and second is time in the format HH:NN:SS. Both parts should have a single space in between them.
I tried to load into the Flat file with Timestamp format , its loading perfectly
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Post by shilpa79 »

DSguru2B wrote:Try changing it. Also, since this is such a struggle, load it to a flat file, just a few records to see how it looks like. It should have two parts. The first is date in the format YYYY-MM-DD and second is time in the format HH:NN:SS. Both parts should have a single space in between them.
I tried to load into Flat file with sqltype Timestamp sucessfully
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Did you spot check a few fields in the flat file. Is the conversion correct?. Also in my initial input, ICONV for time should be "MTHS" instead of "MT" This conversion will only be successful if there is no space between seconds and AM/PM. If there is space you need to get rid of that space then.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

While Searching the forum I found this post
viewtopic.php?t=102661&highlight=
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Once you read it as Varchar, try to maintain it as Varchar till your target stage and convert it back to Data format.
Do you get any error or warning in current scenario?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Hi Kumar, I tried that part at my end but the issue seems to be with time part, But waiting for OP's response.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

us1aslam1us wrote:Hi Kumar, I tried that part at my end but the issue seems to be with time part, But waiting for OP's response.
Did you used Convert()? May I know the code that you used? I too lazy to search for that. :?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
pavanns
Participant
Posts: 27
Joined: Wed Sep 28, 2005 8:00 pm
Location: ca

Post by pavanns »

i tried doing it with varchar all the way but does not work as it says cannot insert null into the column.
pavan
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

pavanns wrote:i tried doing it with varchar all the way but does not work as it says cannot insert null into the column.
As noted, its may be due the datatype mismatch. You cannot load varchar as it is in to a Date field. You need to have a date conversion at the target stage.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

pavanns wrote:i tried doing it with varchar all the way but does not work as it says cannot insert null into the column.
Is it possible that your getting null from source and trying to insert to a not null column?
None of the rows get inserted?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply