Hi,
We're currently using Access 2013 to manage some data and it need to reference some other information from SQL Server. This normally isn't an issue.
I've written a view that we can use as a linked table to pull selected data into Access but some users (not all) are getting the error:
The following query to create the SQL view works for everyone but pulls through all 900k items to the linked table in Access:
What we want is the latest date for each reference (~196k items) so the following should work and does for me and a couple of others but not everyone:
The aggregate seems to cause the error. I've also tried
We have an inefficient work-around (this query is only part of a larger group of queries to create a more complicated view but is the cause of our woes) but I'd like to understand why this is happening to prevent it in the future.
Thanks
We're currently using Access 2013 to manage some data and it need to reference some other information from SQL Server. This normally isn't an issue.
I've written a view that we can use as a linked table to pull selected data into Access but some users (not all) are getting the error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Conversion failed when converting date and/or time from character string. (#241)
.The following query to create the SQL view works for everyone but pulls through all 900k items to the linked table in Access:
SQL:
SELECT linkRef, DateUpdated
FROM myTable
WHERE DateUpdated IS NOT NULL
What we want is the latest date for each reference (~196k items) so the following should work and does for me and a couple of others but not everyone:
SQL:
SELECT linkRef, MAX(DateUpdated) AS DateUpdated
FROM myTable
WHERE DateUpdated IS NOT NULL
GROUP BY linkRef
The aggregate seems to cause the error. I've also tried
SELECT linkRef, CAST(MAX(DateUpdated) AS DATETIME2(0)) AS DateUpdated
as well as SMALLDATETIME
. The data type of DateUpdated is DATETIME2(0)
so we shouldn't have conversion issues and all dates in this field appear to be valid.We have an inefficient work-around (this query is only part of a larger group of queries to create a more complicated view but is the cause of our woes) but I'd like to understand why this is happening to prevent it in the future.
Thanks