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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:34:00+00:00 2026-05-29T06:34:00+00:00

This question is just for my personal future knowledge since the database it applies

  • 0

This question is just for my personal future knowledge since the database it applies to is already going in a specific direction.

In a SQL Server 2005 database we have a function that returns a DateTime value based on Utc time and the local client’s time zone. This function has been applied in two ways:

  1. As a function call in the default value for the column
  2. As a function call within an INSERT statement in various stored procs.

Obviously the first method is easier to implement up front and, arguably, much more scalable in terms of development effort.

My question is whether or not there is a notable advantage in efficiency to using one method over the other in terms of workload on the server/time to complete the transaction. I hope this question isn’t too vague. Thanks for any insights in advance.

  • 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-29T06:34:00+00:00Added an answer on May 29, 2026 at 6:34 am

    If it is the default value, it will be calculated exactly once. If it is part of the stored proc to do inserts it will be calculated only once. If the calculation is done on a proc that does a select (I know you aren’t suggesting this but some future reader might be thinking about it), it would be re-calculated many times.

    If it is the default, then you can be sure it will always be populated no matter how the data is entered in the database. If you have something that needs to be updated if the other data changes, then a trigger would keep it up to date no matter how the data got changed. If multiple stored procs might get written to do the same thing (which mught be called by differnt apps), then you are more at risk that different methods to populate the field will be used. Further you are at risk that data will be entered outside the insert proc from the query window, a script, an import, etc. This is especially true if you might need to port large amounts of data from another system or a new client and running one record at a time through an insert proc is too slow.

    I say the default function (and a trigger if you need to keep the date updated for any reason) is the easiest to maintain and the way that is least likley to negatively affect data integrity. It is also likely as fast as a stored proc to do the insert and far better than a stored proc that would do the calculation on select instead of on insert.

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

Sidebar

Related Questions

I already know the obvious answer to this question: just download <insert favorite windows
This question is just for a sake of knowledge. I don't have any practical
This question is not a homework, it is just out of personal interest and
Please do not mark it as a dupe of this question just yet: Bold
This question is just out of interest, and perhaps could be useful for my
This question is related to another question I just posted . I'm prepping for
I suppose this question could just as easily be applied to PHP with regard
A Java version of this question was just answered, and, well, I don't know
I have just asked this question an hour ago but with regards to IE8
I just asked this question . Which lead me to a new question :)

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.