[SQL Server] Update datetime2 column does not work

Open
#573 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
fsharp, sql
Domain
databases

Research direction

No source file or test is named. Start by reproducing the SQL Server 2016 case with the shown SqlTypeProvider query and SubmitUpdates call, then trace how the datetime2(7) assignment is detected and persisted. Done means the existing row is updated, or a clear update error is raised instead of silently completing.

Written by the indexing model from the issue text.

Description

Description

I cannot update a row containing a datetime2(7) column in SQL Server.
Updates on other datatypes, for example plain int works well.
Inserts with DateTime into this same table works well.

Repro steps
  • Sql server 2016
  • SqlTypeProvider 1.1.50
type MyDb = SqlDataProvider<ConnectionStringName = "ConnStringInAppConfig", DatabaseVendor = Common.DatabaseProviderTypes.MSSQLSERVER, UseOptionTypes = true>

let ctx = MyDb.GetDataContext()
let entityToUpdate = query { from e in ctx.Dbo.MyTable do where (e.Id = myId) select e }
e.ValidFromDate <- new DateTime(2018, 08, 08)
ctx.SubmitUpdates()
Expected behavior

The column is updated, or else an error is raised that it could not be updated.

Actual behavior

Silently finishes, nothing is updated. No "pendingchanges" remain.

Known workarounds

Delete row and recreate it.

Related information
  • SQL Server 2016
  • Client on Win10, server on Windows Server 2012
  • Latest released version on nuget
  • NET Framework 4.6.1
Dominant language
F#
Stars
627
Forks
147
Avg merge
2h 2m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/SQLProvider

All issues in fsprojects/SQLProvider

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.