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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:20:46+00:00 2026-05-22T18:20:46+00:00

How do i combine 2 column using SQL server 2005 ? Problem is that

  • 0

How do i combine 2 column using SQL server 2005 ?

Problem is that The DateTime is stored in 1 column and the milliseconds is stored in another column.

I want to add the Milliseconds onto DateTime column to give it a more accurate DateTime.

I need to use this DateTime to query record accurate to milliseconds.

Any idea?

I need to replace DateTime with the added values.

SELECT * 
FROM TABLENAME 
WHERE [DateTime] >= '2011-04-12 12:00:00 AM'
AND [DateTime] <= '2011-05-25 3:35:04 AM'

and run the query.

  • 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-22T18:20:47+00:00Added an answer on May 22, 2026 at 6:20 pm

    Well, first solve your problem:

    SELECT DATEADD(millisecond,<milliscolumn>,<datetimecolumn>) from <table>
    

    And then file a bug report that these should just be stored in one column anyway.


    You can do this, based on your sample query, but note that this destroys the possibility of the server being able to use an index:

    SELECT * FROM TABLENAME WHERE
        DATEADD(millisecond,[MillisecondColumn],[DateTime]) between
            '2011-04-12T12:00:00' AND '2011-05-25T03:35:04'
    

    If this is a large table, then indexes may be important. If you can’t alter whatever’s populating this data, you might want to add this calculation as a persisted computed column to this table, and then index and query against that.

    Note that I’ve replaced your two comparisons with a single BETWEEN, and also adjusted the datetime strings so that they’re not affected by regional settings.

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

Sidebar

Related Questions

Using SQL Server 2005, I am working with a database which has two columns
While implementing a tree structure over a SQL 2005 server database, the query response
In a table I want to combine some of the columns, but not in
I want to do a select in MySql that combines several columns... something like
I want to combine these: keys = ['name', 'age', 'food'] values = ['Monty', 42,
I know you can combine multiple table-selects using a Join statement but is there
I am using Path.Combine , and one of the strings contain a Unicode characters.
Basic table with empname and empdpt. In a Sql Server table, I can do
I'm creating a JasperReport using iReport, and as such, I'm limited* to one SQL
Is there anyway to combine all resources into a single exe file such as

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.