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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:28:43+00:00 2026-05-11T14:28:43+00:00

I have a table that stores stock ticks in sql server 2008. It is

  • 0

I have a table that stores stock ticks in sql server 2008. It is keyed on the symbol column and the datecolumn which is a datetime2. In a c# app inserts are sent in at a high rate to the table. Currently a row is made using the symbol and DateTime.Now and then inserted. Occationaly the situation can arise where 2 ticks for the same symbol come in and the datetime.now will return the same time, down to the millisecond. My question is how can I assure that my inserts do not use the same time for a given symbol. I fiqure I could have another unique key like rowver or somekind of autonumber in the db as one solution, but even if the insert is successful I dont want there to be duplicte times for a given symbol. I’ve also thought about storing the last insert time and just adding a millesecond to it if it is equal. I’m not sure the best way to go about this. Also the datetime2 seams to have more precission than the .net datetime, so don’t know if I should try to solve this on the server or the client.

Thanks

I want to keep every insert no matter what and for performance reasons I don’t want to go with checking prior values, so the solution I will go with is an identity column. That will allow me to preserve the order of the inserts while allowing duplicates in the datetime2.

  • 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. 2026-05-11T14:28:44+00:00Added an answer on May 11, 2026 at 2:28 pm

    Don’t use the datetime in the key.

    Use an identity column as the primary key, and just put an index (could be clustered if you want) on the tick+datetime. I’m not sure what you want with the dups, but this way you will be able to record that they happened…

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

Sidebar

Ask A Question

Stats

  • Questions 114k
  • Answers 114k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Depending if you auto-load the session library or not, we… May 11, 2026 at 10:19 pm
  • Editorial Team
    Editorial Team added an answer You can define the %done as total (sub)nodes done divided… May 11, 2026 at 10:19 pm
  • Editorial Team
    Editorial Team added an answer They are executed in whatever thread the event is triggered… May 11, 2026 at 10:19 pm

Related Questions

I have two tables, one stores the products and quantity we have bought, the
I'm building this report in a system for a Billboard company. They have a
I am trying to write a Firefox 3 add-on which will enable me to
I am having a problem determining how c# and LINQ solve the common problem

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.