two kind of date formats data loaded on mysql field - mysql

A person developed a Mysql data base to migrate from access for an aplication, however, the dates in Access were saved as 'd-m-Y'. When this person loaded the access data, it was storaged in the original format, however, the new data is loaded in Mysql date format 'Y-m-d' in the same fields.
What can I do to uptade the historical data to change its format from 'd-m-Y' to 'Y-m-d'?

Related

How to insert date( in different format ) coming from a CSV file to MySQL

I'm inserting a row coming from a CSV file into my SQL database. The birthdate column that I have on the CSV file has a date format like this 10/29/1992, it seems that the Google Sheets that I use to create the CSV file convert it to that format even though I input it like this 1992-10-29, since the latter format is the format in the SQL database for dates.
So I tried importing the CSV file to my table in the database, and it won't insert the birthdate column correctly, it inserts 0000-00-00 and gives me a warning Mysql date warning data truncated. So it seems it's impossible to insert in this format 10/29/1992
What could be the best way to solve this? Without handling this on the backend or server side? Can this be handled in the phpMyAdmin settings or in google sheets so that it won't convert the date I input to a different format?
I just found out that in Google Sheets where I create the CSV file, there's a setting where you can custom format your dates for a date column. I guess that's all I needed so that the date format from the CSV to the MySQL table will match. The setting can be found in Format-> Numbers-> Custom date and time

SSIS - Flat File Destination data formatting

If I have a column of type DT_DBDATE or DT_DBTIMESTAMP, and I write the data to a file using a Flat File Destination component, the resulting date formatting will YYYY-MM-DD HH:MM:SS. I've experimented with changing the package locale and changing the datatype in the Flat File Connection Manager, but these don't seem to have any effect.
What determines this format and is there any way I can change the default formatting?
PS. I know I can use Data Conversion and Derived Column components to change the data types/formats. The point is we have +150 packages and get too many errors when someone forgets to do the conversion or does it incorrectly.
We're using SSIS 2012.
I had a similar issue while using SSIS 2008 with SQL Server 2008 R2. If you are trying to generate a CSV file, I would recommend first, at the database level, to store the value in the desired format. This means, for instance, if you want to display a column where the current date is in the format YYYY-MM-DD, then you should use the appropriate code to store that value. Using T-SQL will be: convert(varchar(10), cast(GETDATE() as date), 126). Double check that the value was stored in the desired format by reading the table. Now it comes the tricky part: no matter what you are using in SSIS for transforming the dates, if you open the CSV using Excel, then Excel is going to display the dates using the format was set for the operating system. Don't panic, just don't save that file when you want to close it. Instead, if you open the CSV using Notepad or Notepad++, you should be able to see the date columns right in the format you used for storing them in the database.

Facing issue in date while getting record from salesforce:mule

I am facing issue while reading data from SalesForce.
Current Scenario:
Read data from SalesForce account and store into csv file.
In SalesForce whenever we insert data at that time createdDate field store as current date. My problem is when I read data from SalesForce at that time in csv file it store current date as (createdDate+1) in few of records not in all records.
For example my date is 1/12/2015 in csv file it store 13th.
Didn't get any idea why this is happened.
My flow is
http->salesforce->data_mapper->file-outbound
This is more than probably a TimeZone issue, let's say that salesforce server is in UTC and that your computer is in GMT+4 because you are in Rusia. Any record from 22:00 or later will show up as +1 days.
Set the default timezone of Java, your system or otherwise manipulate the dates with MEL datetime functions.

How to Explicitly convert data type while inserting data into MS-SQL from external system?

I tried inserting data into column from extrenal system but it is returning the nvarchar format data, where as the data is actually in Numeric format.
hence the data is being lost as it is automatically converted to Exponential format.
No way to convert the data type from this external system.
Is it possible that at the point of insertion of the data into my MS-SQL db it should again cinverted to Numeric format?
What do you mean by external system?
Say for example, it is MS Excel spreadsheet, you still can use the native t-sql functions to convert the data type of the columns. And that too should be the case with most of the external data.
SELECT Name, Age, convert(decimal(5,2), Amount) FROM OPENQUERY (XLSX_NewSheet, 'Select * from [Sheet1$]')
or
SELECT Name, Age, convert(decimal(5,2), Amount) FROM XLSX_NewSheet...[Sheet1$]
Where Name, Age and Amount are Excel sheet's column header names
The External system is a Data extraction tool for Salesforce called Apex data loader. its due to Salesforce limitation during the extraction of Numeric field with more than 8 digits, converts automatically to exponential notation and the same data is inserted into the MS-SQL Db which is actually not the correct data.

ODBC linked table not showing fractions of seconds

I have linked an IBM informix database table through an ODBC connection to an Access 2010 database. My issue is that the date field in this table only shows dd/mm/yy HH:nn:ss in the Access view, where the stored data is to 1000th of a second.
I can show this in Excel 2010 but not in Access 2010: is this possible? Not having this level of accuracy is preventing me making accurate calculations!
There is a similar question on another forum here. The Date/Time field type in Access does not store fractions of seconds, and linked tables implicitly cast their columns to the corresponding Access data type, so the fractions of seconds are not available in a linked table even though they are stored in the remote database.
For example, I have a SQL Server database with a table named dbo.linkedTable that has a datetime column with fractions of seconds:
If I create a linked table in Access the [datetimeCol] is mapped to the Date/Time field type in Access and the times are rounded to the nearest second
As a workaround, I can create a Pass-Through query that uses T-SQL to convert the datetime value to a string...
SELECT ID, CONVERT(varchar, datetimeCol, 21) AS strDatetime FROM dbo.linkedTable
...returning...
...and I can parse the [strDatetime] string value to retrieve the fractional seconds.