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

  • SEARCH
  • Home
  • 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 6341149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:58:22+00:00 2026-05-24T19:58:22+00:00

I have a small question about stored procedures and the DateTime2 datatype in SQL

  • 0

I have a small question about stored procedures and the DateTime2 datatype in SQL Server 2008.

I got several stored procedures using the DateTime2 datatype and I want to insert the date 0001.01.01 00:00:00 but this won’t work with VB.net and I cannot find the reason why.

I use this code fragment:

Dim sqlStatement As New SqlClient.SqlCommand
Dim sqlTransaction As SqlClient.SqlTransaction
sqlStatement.CommandType = CommandType.StoredProcedure
sqlStatement.CommandText = "SCHEMA.spInsertDate"
sqlStatement.Parameters.AddWithValue("@Date", "0001.01.01 00:00:00")
sqlStatement.ExecuteNonQuery()

to call the stored procedures from my program (the stored procedure is a simple INSERT statement nothing else and works fine with actual dates). But when I enter the date 0001.01.01 00:00:00 it always comes up with the error that I cannot insert dates before ‘01.01.1753’ when I want to execute the stored procedure.

Now I already know that the DateTime2 datatype in SQL Server should support this.

So my question is it possible that this is a driver problem and updating the SQLClient would solve this, or is this a general problem and I can finally stop searching and just use 1753.01.01.

Thanks Lim

  • 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-24T19:58:23+00:00Added an answer on May 24, 2026 at 7:58 pm

    If you don’t specify anything for your SQL parameter and use the .AddWithValue() method, I believe ADO.NET will default to use SqlDbType.DateTime which has this limitation in its range (no dates before 1/1/1753).

    You need to explicitly define the datatype of your parameter with this call:

    SqlParameter dateTime2Param = sqlStatement.Parameters.Add("@Date", SqlDbType.DateTime2);
    dateTime2Param.Value = "0001.01.01 00:00:00";
    

    Then it should work, I believe. The SqlDbType enumeration had this DateTime2 type added in .NET 3.5

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

Sidebar

Related Questions

I am developing a small stored procedure on SQL server 2008. I have little
I'm using BerkeleyDB to develop a small app. And I have a question about
I have a small question about using jquery. I have the following code: <html>
I want to put a question about what ideas do you have regarding Open
Database : SQL Server 2008 Is there a way to have an insert statement
I have a question about base64 encoding for images. I used base64 for small
I have a question about the exit button. I have read several posts on
i have posted a few hours ago question about newtons method,i got answers and
I have an small question I didn't found an answer yet: how do I
I'm not much into COM interfaces, so i have a small question, say I

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.