Internal Date format to SQL Server Date format.

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

Post Reply
koolsun85
Participant
Posts: 36
Joined: Tue Jun 15, 2010 3:30 pm
Location: Tampa

Internal Date format to SQL Server Date format.

Post by koolsun85 »

Hello All,

I am trying to convert the internal format to SQL Server Date format. It is unable to convert and inserting NULLS - which i cannot.

Help Appreciated.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Where are you getting this "internal format" from and how exactly are you attempting to convert it? Post the syntax you are using.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koolsun85
Participant
Posts: 36
Joined: Tue Jun 15, 2010 3:30 pm
Location: Tampa

Post by koolsun85 »

I have used ICONV(input.date,"D-YMD[4,2,2]") to convert it to internal format. this output number has to be inserted into sql server.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:?

So... you are successfully converting a date string in YYYY-MM-DD format to an internal date using what you posted, yes? And now you need to insert the result into SQL Server. What is the datatype of your target database column - DATETIME, SMALLDATETIME, something else? What is the "SQL Server date format" that you need to use for that?

Whatever your target datatype is, try search here for it as there have been quite a number of people who have asked the same questions. Best to restrict your search to the Server forum, or at least posts marked with a Job Type of Server.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koolsun85
Participant
Posts: 36
Joined: Tue Jun 15, 2010 3:30 pm
Location: Tampa

Post by koolsun85 »

Yes.. I could convert .. My target data type is date.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't "do" SQL Server, so don't know what it expects. How would you do this outside of DataStage? What syntax would you use or what format would the date need to be in to allow it to insert successfully into that field?

Anyone who works with SQL Server care to chime in?
-craig

"You can never have too many knives" -- Logan Nine Fingers
suse_dk
Participant
Posts: 93
Joined: Thu Aug 11, 2011 6:18 am
Location: Denmark

Post by suse_dk »

If you have managed to convert your input string correct to a ds date type (yyyy-mm-dd) then you should be able to insert this into a sql server date column.
Could you please poste an example of the input string for the transform?
_________________
- Susanne
koolsun85
Participant
Posts: 36
Joined: Tue Jun 15, 2010 3:30 pm
Location: Tampa

Post by koolsun85 »

I just mapped the internal ds format to sql server and checked whether it works or not- it worked with out any issues..

My Source is YYYY-MM-DD, for all my transformation i have to convert it to internal ds format and while loading into sql server ( Date - datatype) .. just map the internal ds format to the ouput date... it worked for me.

Thanks for the initial help.
Post Reply