ODBC linked table not showing fractions of seconds - ms-access

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.

Related

informatica Datetime conversion to SQL server Timstamp

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."

Why do SQL Server and MS Access return different results for equivalent input?

I'm migrating an Access project in which there is a division operating with a date value, the problem is that the table where the value must be inserted is Float type.
Given that Access and SQL Server return different results while operating the division or conversion to float, I need to know what is the math operation to create a function in SQL Server to mimic the Access conversion to double.
For example, the following conversion in MS Access.
Select CDbl(#12/31/2016#);
Results in 42735.
While the equivalent in SQL Server
declare #ADate DateTime;
Set #ADate = '20161231'
select CONVERT(float, #ADate);
Results in 42733
The actual code I'm trying to migrate includes the following syntax:
Select (NumericField - DateField)/30 From ATable;
Is there a reason why someone could divide a date by 30?, as you might know, when MSAccess operates with adding/subtracting would add/subtract days to the date, so if there were a default for dividing I wouldn't have to operate with the underlying storage of the Access date.

What data conversion can happen between client software and target DB when using ODBC?

I have a problem with using Crystal Reports to retrieve data from a MySQL DB.
In this case Crystal connects to the MySQL DB using ODBC, and the ODBC middleware was built using Progress DataDirect.
The target DB has a table in which a field has integer values like "2014" and "2015". However, when I check the values in this field in Crystal (using the "Browse Data" function) it shows the values as "14.00" and "15.00".
This field is used in the SELECT statement stored in Crystal and that statement is restricting the records to those where the value is "2015". As a result the report shows no records because Crystal is not seeing the correct values.
Changing the SELECT statement to retrieve all records where the year is "15" (or "15.00") is not helping either. I am presuming this is because the DB does not contain any records with that value.
So in summary the situation is:
Use "15" or "15.00" in the SELECT statement: fails in DB because of no records with that value
Use "2015" in the SELECT statement: fails inside Crystal which sees the value as "15.00"
Is there some functionality on the ODBC layer that can cause this situation?
You can cast those integers to string:
SELECT CAST(y AS CHAR) FROM mytable
This way all conversion should be done on server side.

How to obtain values above A9999 in MS Access 97 frontend with a MySQL V5.2 backend?

I have inherited a database which is an MS Access 97 frontend with a MySQL V5.2 backend. In MySQL I have a table with a Primary Key field set at VarChar (50). This was setup because our reporting system uses an alpha numeric identification. The same field in the linked Access table is set at text. At present, I have a query which returns new sequential values over a set value (eg) >S/1234 to generate values which are then added to the above table. The users then use these values to print a series sequentially numbered reports. However, I have now come to value S/9999 and users can no longer use the query to obtain values > S/9999. Any ideas of how to solve this problem would be appreciated. Thanks.

SQL Server 2008 Time DataType Classic ASP

I am storing a check-in time and a check-out time in a table in SQL Server 2008.
When I store the time it shows correctly: 16:00:00 for example.
However when I pull this out of the database and bind it to the page to show the user the format displays as 16:00:00.0000000
So the precision is obviously precise but I don't need that for this purpose.
I've tried FormatDateTime but that doesn't work (obviously) and cannot find anything for Classic ASP and SQL Server 2008 Time datatype on Google.
<%=(rsHotelFields.Item("checkintime").Value)%>
Any ideas on how to change the above?
Thanks
Nick
By default, if you define a column in SQL Server 2008 to be of datatype TIME, it will use the maximum possible accuracy - 7 digits for the fractional seconds, accurate down to 100ns.
This is fine - but if you don't need that kind of accuracy, you can define your column to be:
YourColumn TIME(0)
and then no fractional seconds will be stored, just 16:04:44 and this same value will also be retrieved again from the database table to be displayed.
Using TIME(0) also reduces the storage size of the column from 5 bytes to 3 bytes.
Read more about the date and time datatypes for SQL Server 2008 and newer on MSDN.