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 7540595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:40:59+00:00 2026-05-30T07:40:59+00:00

I was looking for a deterministic truncate function for datetime and this one did

  • 0

I was looking for a deterministic truncate function for datetime and this one did the job:

DATEADD(dd, DATEDIFF(dd, 0, @date), 0)

But this is supposed to be the input to a persisted computed column which will be a part of the primary key, so it has to be non-nullable. So I made this:

ISNULL(DATEADD(dd, DATEDIFF(dd, 0, @date), 0), '01.01.1900')

But now the expression became non-deterministic. Can anyone tell me why, and how I can make it deterministic?

Thanks!

  • 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-30T07:41:00+00:00Added an answer on May 30, 2026 at 7:41 am

    01.01.1900 isn’t deterministic…

    This is:

    ISNULL(DATEADD(dd, DATEDIFF(dd, 0, @date), 0), CONVERT(datetime, '19001010', 112)))
    

    or this

    ISNULL(DATEADD(dd, DATEDIFF(dd, 0, fooDT), 0), 0)
    

    For more, see Why is my CASE expression non-deterministic? which leads to best way to convert and validate a date string

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

Sidebar

Related Questions

I am looking for a deterministic implementation for any 3d bin packing algorithm, i.e.
Looking for simple php class routing, like this: http://fatfree.sourceforge.net/page/routing-engine Is there a ready-made solutions?
I've tried looking on google but i guess I can just not get the
Looking to validate PO Box but wanted to know if such validation existed. I
Looking through this C++ BigInt library and found the BigInt.cpp file. At the top
This problem came up in the real world, but I've translated it into a
Looking for suggestions on how to approach this problem and to understand if Domain
I am looking for a Java library which can convert Non-deterministic Finite Automaton to
Looking at: member this.PostAndReply : (AsyncReplyChannel<'Reply> -> 'Msg) * ?int -> 'Reply I can't
Looking for feedback on : http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools

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.