locked
sql query RRS feed

  • Question

  • The “LoanDetailsExample” table updates from the core system daily at 11pm and appends a new set of data for that day (ProcessDate). However, the ProcessDate is formatted as an integer in the output from the core system (as yyyymmdd).

    How would you write a SQL query that would run in the morning, which will always return the total number of accounts as of the most current update?

    Friday, February 2, 2018 2:09 AM

All replies

  • It should be something like,

    select * from myTable where ProcessDate(hh, myDateField) > 11


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (kokkisajee) or Facebook (sajeetharan) profile for Sajeetharan at Stack Overflow, Q&A for professional and enthusiast programmers

    Friday, February 2, 2018 2:19 AM
  • Thanks,

    would it be myDateField or Current_timestamp ?

    Friday, February 2, 2018 2:54 AM
  • The “LoanDetailsExample” table updates from the core system daily at 11pm and appends a new set of data for that day (ProcessDate). However, the ProcessDate is formatted as an integer in the output from the core system (as yyyymmdd).

    How would you write a SQL query that would run in the morning, which will always return the total number of accounts as of the most current update?

    Friday, February 2, 2018 11:56 PM
  • Duplicate post. And do your own homework.
    Saturday, February 3, 2018 3:43 AM
  • As per your definition the ProcessDate doesnt have time part. That being the case you can use the below to get the full data that got populated in the last day

    SELECT *
    FROM LoansDetailsExample
    WHERE ProcessDate = FORMAT(DATEADD(dd,-1,GETDATE()),'yyyyMMdd')
    


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Saturday, February 3, 2018 7:59 AM
  • Thanks, never did like people named scott
    Saturday, February 3, 2018 9:16 PM
  • Hi kpomavi,

    Could you please tell us if you have solved this problem? If it is, please mark these helpful replies as Answered, if not, please share more information to us.

    Best Regards,

    Teige


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Teige Gao Monday, February 26, 2018 2:35 AM
    Friday, February 9, 2018 7:51 AM