Sql Server ODBC Date Field - Optional feature not implemented
Asked Answered
C

3

5

I have a SQL Server table which has fields of type Date in it. I am trying to update or insert a record into the table via Micosoft Access using ODBC. I get the error:

[ODBC SQL Server Driver]Optional feature not implemented

when I try and update or insert a record.

I have to use Date fields not DateTime fields in my table because I am using very old dates going back 2000 years.

Is there any way round this problem, which I assume is caused by the Date fields?

This is what the table looks like

CREATE TABLE [dbo].[Person](
[PersonId] [int] IDENTITY(1,1) NOT NULL,
[DOB] [date] NOT NULL,
[DOD] [date] NULL DEFAULT (NULL),
[Name] [nvarchar](100) NOT NULL)
Cellini answered 12/1, 2016 at 13:31 Comment(7)
How about posting the code you are using so we can try and spot the problem?Lyle
You have an MS_ACCESS tag on this. What part is Access playing?Alfieri
@simonatrcl Rob posted ."..via Micosoft Access using ODBC..." there are dozens of search results on this topic, but they mention specifics which I think we need to see the code for. i.e. support.microsoft.com/en-us/kb/214459Lyle
@WayneG.Dunn - D'Oh! Sorry! Agree on the need for code.Alfieri
@WayneG.Dunn there isn't any code though. I am editing a record in Access. Any Sql is generated in Access and gets sent to Sql Server via ODBC,Cellini
@simonatrcl the access tag was added by the moderator, but it is the software where the editing takes place. I don't think it's really an Access issue, I think it's more of an ODBC issue which is why I left that tag out,Cellini
Are you opening the linked table directly and trying your add/change? Or do you have a form involved? Are you using a stored procedure? Can you add / change ANY records? if so, under what circumstances? Does it always fail if touching a certain field? Does it always work if NOT touching a certain field? I have found a bunch of articles relating to Date / ODBC / Access, but without knowing how and what you are trying to store in the date field...Lyle
C
6

You best bet is to dump the use of the "legacy" sql driver, and user the newer native 10 or 11 driver. The older driver will view date fields as text, but using the newer native 10/11 driver will see the column as a date column. This will require you to re-link your tables.

Chevaldefrise answered 12/1, 2016 at 20:29 Comment(2)
Quite right, using the SQL Server Native Client 11.0 did the trickCellini
+1 this worked for me. These days, "ODBC Driver [version] for SQL Server" is recommended over the "native" driver though, as detailed here: https://mcmap.net/q/244428/-differences-between-drivers-for-odbc-driversFax
H
2

If you can't change your SQL Server version, an easier solution is to pass the date as an adVarChar, and then do a CAST(@param AS DATE) in your SQL stored procedure.

Howes answered 28/11, 2017 at 12:37 Comment(0)
K
0

I've experienced the same problem today. I use MsAccess 2010 for developlemt, and have MsSql2012 at back-end.

There was no problem on my computer, but other clients that use the accde runtime version has experienced this trouble.

After several trials; Issue resolved when replacing DATE type with SMALLDATETIME. please try this..? Indeed I only needed the date part, not the time, but ok anyway!

[DOB] [date] NOT NULL, [DOD] [date] NULL DEFAULT (NULL),

Hope this helps to you as well

Kenji answered 16/7, 2018 at 8:24 Comment(1)
I don't think this is the best answer because you are changing your database types when all you need to do is use the correct driver (see accepted answer)Cellini

© 2022 - 2024 — McMap. All rights reserved.