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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:06:18+00:00 2026-06-08T13:06:18+00:00

I have a table that contains a DateField(DataType : DateTime) and TimeField(DataType : Float)

  • 0

I have a table that contains a DateField(DataType : DateTime) and TimeField(DataType : Float)
My output should be DateTime . My tables are in SQL Server 2008

Here is an example :

Table A

ID  StartDate                            StartTime
1   2012-06-08 00:00:00.000              1223
2   2012-08-07 00:00:00.000              910
3   2012-05-02 00:00:00.000              1614
4   0094-07-13 00:00:00.000              1245
5   1994-04-18 00.00:00.000              2573

I need to get my output in such a way that I should it should validate for the correct time and correct date and append these two and insert into table B

Table B :

ID    StartDateTime
1     2012-06-06 12:23:00.000
2     2012-08-07 09:10:00.000
3     2012-05-02 16:14:00.000

Note that I intentionally left rows 4 and 5 out of the result set; these rows should be ignored because they don’t contain valid datetime or time data.

  • 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-06-08T13:06:21+00:00Added an answer on June 8, 2026 at 1:06 pm

    Have you considered correcting the design, and storing the date/time together, or at least storing date and time using the proper data types? In the meantime:

    SELECT StartDate + STUFF(RIGHT('0' + RTRIM(StartTime), 4), 3, 0, ':') 
      FROM dbo.table
      WHERE ISDATE(StartDate) = 1 AND CONVERT(INT, StartTime) < 2400
    
      -- wow what a bunch of absolute garbage data you have
      -- what Government agency are you paying to provide this data?
    
      AND CONVERT(INT, StartTime) % 100 BETWEEN 0 AND 59;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that contains a GEOMETRY data type. SQL Server 2008 ships
I have a table that contains the following columns: ID int, DISTANCE float, EVENT
I have a table that contains a column of XML Datatype (column name FileContent).
I have a table that contains fields start_date and end_date both in datetime format.
I have a table that contains float values. table + id | value |
I have a table that contains multiple dropdown menus for a list of profile
I have a table that contains all the data about users . Users can
I have a table that contains common entries in two columns. For Example: Column1
I have a table that contains the stock. It's legacy database and the stock
I have a table that contains a record of prioritys that links to another

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.