informatica Datetime conversion to SQL server Timstamp - sql-server-2008

I have a requirement where I have to load Informatica SESSSTARTTIME(datetime) to SQL server timestamp. When I am trying to connect datetime to timestamp I am getting error incompatible data type. 
Any suggestions how this can be achieved? 
Thanks

I had a similar issue in the past, where the date column was not getting loaded because of the difference in precision of date/time used by Informatica and SQL server. You can try this workaround: Change the data type in the target definition (not in SQL Server table, only in Informatica Target definition) to String, then Informatica will pass the date/time value in quotes when firing the insert query, which SQL server can convert to date/time automatically.

in the mapping try to create output port in expression as sessionstarttime (which is a inbuilt variable) and pass it to target
hope this will help to get desire output
in session there is config tab where you can change the format for date and time

MS SQL Server timestamp datatype has nothing to do with time. It's an autogenerated number and you cannot load it.
https://msdn.microsoft.com/en-us/library/ms182776(v=SQL.90).aspx
quote:
"Is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type."

Related

Migration of Data from Oracle database to SQL Server

[ADO NET Destination [2]] Error: An exception has occurred during data insertion, the message returned from the provider is: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
I don't understand the error message from SSIS. Please I need help.
Thanks
In C#, when the data is converted from NULL to DateTime, the DataTime.MinValue = 0001-01-01, but in database, the min value is 1/1/1753, so you have to make some treatments to NULL, otherwise when inserting 0001-01-01 (converted from NULL), it will throw you that error.
It is probably problem with different date formats on both sides, maybe different language setting for both databases. For example Oracle uses dd-MM-yyyy and SQL expects MM-dd-yyyy. Try to select datetime fields from both databases to check the format. Then try to solve it by some type of conversion in SSIS. You can try converting Oracle date to universal datetime format and then converting back to MS SQL date format. Of course, SSIS should solve it automatically, but working with dates is often buggy and confusing.
The other possibility is, that you are trying to convert TEXT column in Oracle to datetime column in MSSQL and one of the values in the table does not fit expected date format.

Phoenix JDBC TImestamp Column issues

I am working on Hbase database and using apache Phoenix to access Hbase using normal SQL queries.
I have two columns in table which holds the current UTC timestamp in varchar and Date. after loading some data and when I query back Hbase I am getting strange results for event timestamp column which is of Date type.
Event UTC (Date) :2017-01-13 16:36:59.0
Event UTC (varchar):2017-01-13 21:36:59
above two values should be identical but for each record when querying back Event UTC ( Date) column giving me wrong result i.e exactly 5 hours behind.
I dont know from where this problem is coming .I am not saving any Timezone info and I am aware that Java Util or SQL timestamp doesnt store any time zone info, But really confused with the result set data when running a query. Please Help me in resolving this issue
Most likely it is because of the client's local time zone.
From official docs
Timestamp type:
the internal representation is based on a number of milliseconds since the epoch (which is based on a time in GMT), while java.sql.Timestamp will format timestamps based on the client's local time zone.

How to store "2010-03-26 10:13:04 Etc/GMT" mysql?

I would like to store "2010-03-26 10:13:04 Etc/GMT" value in column of type datetime.
When I try to insert it I got exception:
SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10:13:04 Etc/GMT', at line 1
How to insert data time with time zone.
you have to use datetime column, so value must be 2010-03-26 10:13:04 without any timezone steeings
Any string literal must be delimited with quotes
so, the query must be look like
INSERT INTO table set dtime='2010-03-26 10:13:04';
You can do that in a char field... but not in a datetime field. Look here for more information about timezones in mysql:
http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html
and for changing timezones in the database:
http://dev.mysql.com/doc/refman/5.1/en/time-zone-upgrades.html
MySQL's date/time formats don't support time zones. You would have to "normalize" the time to one specific time zone (usually UTC or the time zone the server is located in), or store the time zone in a different field and calculate the offsets by yourself.
Check out the alternative presented in this blog entry: Storing Times in mySQL it's a bit dated but I think what it says still applies. Apparently, Wordpress stores local and GMT times in two different DATETIME fields.
Related:
mySQL Server timezone support
Dealing with PHP server and MySQL server in different time zones

Date Conversion problem

I was about to import data from a table in MySQL to SQL SErver 2008 through SSIS. But I cant transfer due to Dates in the table. There are some data of datetime data type, like '0001-01-10' which doesnt support in SQL Server where years in date ranges from 1753 to 9999. So how do i solve this in MySQL queries ?
If those dates are valid data, then there's no easy way to deal with that in SqlServer. Basically, a custom date handler is needed. A good-enough approximation might be achieved by separating the year into a single integer field and putting the month and day into a date field with a constant year. Every comparison would then be compound.
More likely—for most business applications—such dates are useless and should be cleaned up, or replaced by NULL values.
Note that none of the SSIS data types are truly equivalent to the SQL Server datetime or smalldatetime types, with their restricted range of allowable dates.
A lot of online documentation suggests the DT_DBTIMESTAMP is equivalent to SQL datetime. This is only true up to a point. Dates outside the allowed datetime range will happily cast to DT_DBTIMESTAMP (or any SSIS date type) - but will then cause an error if you try to write them out to an SQL datetime column.
Confusingly, SSIS represents external SQL datetime columns as DT_DBTIMESTAMP, suggesting that datetime and DT_DBTIMESTAMP are equivalent, when they're not.
This means that you can't anticipate out-of-range date problems in SSIS by casting. If you're eventually going to write to datetime or smalldatetime columns, you have to do an explicit check that the date is not out of range (<1/1/1753, or 1/1/1900 for smalldatetime).

No datetime values populated from MySQL using SubSonic 3 Linq

I have a MySQL table with a couple of Datetime columns. The columns are set to allow null and some have default value '0000-00-00 00:00:00'. This is a conversion project from ASP to ASP.NET so the table is full of data, and where some rows still have the default value, so I had to set "Allow Zero Datetime=True" in the connectionstring to avoid the exception "Unable to convert MySQL date/time value to System.DateTime"
Now when I generate the code it all works fine and I get properties of type DateTime? for those columns, but when I query the database and populate an object representing the table all DateTime properties are null. Other properties gets populated their correct values.
Anybody knows why?
I'm using MySQL Connector 6.1.3 and SubSonic.Core compiled from the github today (11/17/2009)
I did some data cleaning. Updated all datetime columns to null where date was '0000-00...' and removed "Allow Zero Datetime=True" from the connectionstring, and then it works. Guess zero dates are not supported by SubSonic, and why should it, I don´t see any use for zero dates over null.
My trick for converting datetime format from different SQL DBMS is to load the column as VARCHAR. Then use string functions such as SUBSTRING and CONCAT to play around and get the desire format. From experience this saves a lot of time. No need to worry about dbms automatic conversion for datetime.
MySQL uses 'YYYY-MM-DD HH:MM:SS'