Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:55:15+00:00 2026-05-31T20:55:15+00:00

I am getting the error Conversion failed when converting date and/or time from character

  • 0

I am getting the error “Conversion failed when converting date and/or time from character string” when I’m trying to get my database versioned by EF migrations. The problem is the date string that EF generated (‘2012-03-21T18:23:13.525Z’) for new migration script entries is not supported by my version of MS Sql Server (Microsoft SQL Server Express Edition with Advanced Services (64-bit)). Is this a bug? Is there a work around?

CREATE TABLE [__MigrationHistory] (
    [MigrationId] [nvarchar](255) NOT NULL,
    [CreatedOn] [datetime] NOT NULL,
    [Model] [varbinary](max) NOT NULL,
    [ProductVersion] [nvarchar](32) NOT NULL,
    CONSTRAINT [PK___MigrationHistory] PRIMARY KEY ([MigrationId])
)
BEGIN TRY
    EXEC sp_MS_marksystemobject '__MigrationHistory'
END TRY
BEGIN CATCH
END CATCH
INSERT INTO [__MigrationHistory] ([MigrationId], [CreatedOn], [Model], [ProductVersion]) 
VALUES ('201203210144184_init', '2012-03-21T18:23:13.525Z',  0x33, '4.3.1');

EDIT

Nevermind. This has nothing to do with EntityFramework. If my SQL Server database is configured to be backwards compatible to SQL Server 2000, it won’t accept that date format. I guess unless I can get EF to output it’s date string in another format (or get SQL Server to both be backwards compatable to 2000 and still understand the EF date string), I won’t be able to use EF migrations with my database :-(. Please let me know if someone has worked out a way to use EF with a database with compatibility level SQL Server 2000.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:55:16+00:00Added an answer on May 31, 2026 at 8:55 pm

    Just so this question has an answer, the answer is:

    Switch the SQL Server database compatibility mode from SQL Server 2000 to at minimum SQL Server 2005 and the issue with the date string parsing will go away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been getting the error Conversion failed when converting from a character string to
Hi I am getting an error 'Conversion failed when converting date and/or time from
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
I am getting a conversion error every time I try to submit a date
I am getting the following error: Conversion failed when converting the varchar value '2010-01-10'
I'm trying to insert values from gridview to a database but I get error:
I'm getting a compile error conversion from 'int*' to non-scalar type 'foo< int>' requested
Microsoft SQL Server 2008 (SP1), getting an unexpected 'Conversion failed' error. Not quite sure
I am getting the error Exception occurred in NLog ---> System.Data.SqlClient.SqlException: Conversion failed when
I'm getting the following InvalidOperationException: The parameter conversion from type 'System.String' to type 'System.Runtime.Serialization.ExtensionDataObject'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.