Varchar to Datetime conversion and selecting latest datead records

Hi:
I've a table as below:
ActionDate|Status|Name
23/10/2012|Block|James
24/10/2012|Open|James
25/10/2012|Block|James
20/09/2012|Block|Tanya
17/09/2012|Block|Fox
18/09/2012|Open|Fox
27/08/2012|Block|Martin
27/08/2012|Open|Martin
Desired Output is as follows:
ActionDate|Status|Name
25/10/2012|Block|James
20/09/2012|Block|Tanya
Select those records only which has Block staus on most recent date. It will also eliminate those which has Open status on the same date.
One more problem is the ActionDate field is actually Varchar2 type and there are mismatch as well. For example: some of those are in MM/DD/YYYY and
some are in DD/MM/YYYY
So, how can I convert these strings into formated date and make the desired output in a single query. Please let me know.
Thanks/Tanvir

Hi, Tanvir,
853856 wrote:
Hi:
I've a table as below:
ActionDate|Status|Name
23/10/2012|Block|James
24/10/2012|Open|James
25/10/2012|Block|James
20/09/2012|Block|Tanya
17/09/2012|Block|Fox
18/09/2012|Open|Fox
27/08/2012|Block|Martin
27/08/2012|Open|MartinWhenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data.
Desired Output is as follows:
ActionDate|Status|Name
25/10/2012|Block|James
20/09/2012|Block|TanyaSee the forum FAQ {message:id=9360002} for how to format the ouptut on this site (among other things).
Select those records only which has Block staus on most recent date. It will also eliminate those which has Open status on the same date.
One more problem is the ActionDate field is actually Varchar2 type That's not a very good idea. This problem shows just one of the many reasons why you should always use DATE columns for date information.
and there are mismatch as well. For example: some of those are in MM/DD/YYYY and
some are in DD/MM/YYYYThe you have no way of knowing if '01/12/2012' means January 12 or December 1. The query below arbitrarily assumes that will be December 1.
So, how can I convert these strings into formated date and make the desired output in a single query. Please let me know.
Thanks/TanvirHere's one way:
WITH     got_real_actiondate     AS
     SELECT     TO_DATE ( actiondate
               , CASE
                         WHEN  SUBSTR (actiondate, 4, 2)     <= '12'
                     THEN  'MM/DD/YYYY'
                     ELSE  'DD/MM/YYYY'
                 END
               )     AS real_actiondate
     ,     status
     ,     name
     FROM     a_table
,     got_r_num     AS
     SELECT     real_actiondate
     ,     status
     ,     name
     ,     ROW_NUMBER () OVER ( PARTITION BY  name
                               ORDER BY          real_actindate     DESC
                         ,                CASE
                                          WHEN  status = 'Open'
                                     THEN  1
                                     ELSE  2
                                      END
                       ) AS r_num
     FROM    got_real_actiondate
SELECT     real_actiondate
,     status
,     name
FROM     got_r_num
WHERE     r_num     = 1
AND     status     != 'Open'
;This assumes that actiondate is in either 'DD/MM/YYYY' or 'MM/DD/YYYY' format, which is very optimistic. If you sometimes have other formats as well, and/or text that can't be interpreted as a date in any format, then see {message:id=4252963}
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
In the case of a DML operation (such as INSERT) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}

Similar Messages

  • Varchar to datetime conversion

    I have a column which has 05MAY2006:04:34:00.000000 it is stored as varchar(25). I need to save it as datetime in the same column. I have tried using 
    update tablename
    set columnname = (SUBSTRING(columnname,1,2) + '-' + SUBSTRING(columnname,3,3) + '-' + 
    SUBSTRING(columnname,6,4) + ' ' + SUBSTRING(columnname,11,8));
    and then 
    alter table tablename
    alter columnname datetime;
    but later it shows up the error
    Msg 242, Level 16, State 3, Line 1
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
    How do I change it any other opinion or any modification for the above query. Please help. Thank you.

    UPDATE myTable
    SET targetColumn = STUFF ( targetColumn , 10, 1, ' ')
    -- ddmmmyyyy:hh:mm:ss.nnnnnn
    -- this colon is extra which is at 10th positionALTER TABLE tablenameALTER COLUMN columnnamedatetime2;
    vinny

  • Varchar to datetime conversion out-of-range

    I'm importing data from CSV and I get the following conversion datetime error:
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
    The statement has been terminated.
    I'm using the following statement to convert the datetime from varchar(100) to datetime:
    CONVERT (datetime,TimeIndex,103)
    The date in the CSV is in the following format:
    2015-01-31 23:58:19
    Any ideas what could be causing this?
    Thanks in advance
    Adam

    This could be because of british/American date formats.
    Try importing the following dates: -
    2015-01-01
    2015-01-02
    2015-01-12
    ... and see if that works, then try importing 2015-01-13 and see if that works
    Please click "Mark As Answer" if my post helped. Tony C.

  • Select latest two records per group

    hi there,
    i've been googling around and still can't really find an appropriate solution to retrieve two most recent records per group in one sql. Is this even possible?
    Let's say there is a MyLife table :
    ID, Event , RecordedDate
    1. 1, 'Fell down the stairs', '20-DEC-07'
    2. 1, 'Fell down the stairs', '22-DEC-07'
    3. 1, 'Fell down the stairs', '23-DEC-07'
    4. 2, 'Tried to kiss santa', '23-DEC-07'
    5. 3, 'Reindeer stolen', '24-DEC-07'
    6. 4, 'Chimney Broke', '25-DEC-07'
    Output should be :
    2. 1, 'Fell down the stairs', '22-DEC-07'
    3. 1, 'Fell down the stairs', '23-DEC-07'
    4. 2, 'Tried to kiss santa', '23-DEC-07'
    5. 3, 'Reindeer stolen', '24-DEC-07'
    6. 4, 'Chimney Broke', '25-DEC-07'

    I believe that something along these lines would be portable to most other databases.
    SQL> SELECT id, event, recordeddate
      2  FROM mylife o
      3  WHERE recordeddate = (SELECT MAX(recordeddate) FROM mylife i
      4                        WHERE o.id = i.id)
      5  UNION ALL
      6  SELECT id, event, recordeddate
      7  FROM mylife o
      8  WHERE recordeddate = (SELECT MAX(recordeddate) FROM mylife i
      9                        WHERE o.id = i.id and
    10                              i.recordeddate < (SELECT MAX(recordeddate)
    11                                                FROM mylife ii
    12                                                WHERE i.id = ii.id))
    13  ORDER BY id, recordeddate;
            ID EVENT                     RECORDEDDAT
             1 Fell down the stairs      22-DEC-2007
             1 Fell down the stairs      23-DEC-2007
             2 Tried to kiss santa       23-DEC-2007
             3 Reindeer stolen           24-DEC-2007
             4 Chimney Broke             25-DEC-2007John

  • Crystal Data Conversion Issue (Error converting data type varchar to datetime)

    Hi,
    I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
    I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
    But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
    I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
    Error converting data type varchar to datetime.
    Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
    (FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
    Please help me with this issue.
    Thanks & Regards.
    Naveen.

    hello Naveen,
    since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
    by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
    -jamie

  • Have a classic 5th gen. have restored, relaoded itunes, gone through the troubleshooting tips and I still can't sync my latest 3 albums to my ipod. It will sync all but those. Also, when go through ipod trblshoot and select check, says can't see it sync.

    Have a classic 5th gen. have restored, relaoded itunes, gone through the troubleshooting tips and I still can't sync my latest 3 albums to my ipod. It will sync all but those. Also, when go through ipod trblshoot and select check for sync, says can't see my ipod. pls help

    Thanks for the reply. The Itunes trouble shooting in Itunes help. I don't get an error message, it just states can't see ipod like if it wasn't plugged in. I do get an error message on a few of the songs when sync that say error 50, and state that they can't be loaded to ipod. The weird thing is that I can load all of my libary except the latest 3 albums. They are in my libary but they won't load. I'm not sure but it seems like it started when the cloud came about from amazon which is where I buy most of my music.

  • Latest Skype update - issue with lost conversations and contacts

    Can anybody help with this problem?The new Skype layout looks like a classical Microsoft Office sotware (scroll-down menus from the top bar) and in spite of what was announced before installing the update, the damage to the history of conversations and contacts is massive!!!

    MMy iPhone was synced with my computer and the cloud. After re syncing, pics and contacts remain in cloud and computer but won't sync to my iPhone. Even my IT guy at work is stumped! I would love to have all my pics and contacts back on my phone. I have not yet updated my iPad d air because I'm afraid the same thing will happen.

  • UTC or GMT to Australia Local DateTime Conversion (Melbourne, Victoria)

    Hi Guys,
    I have to convert UTC or GMT DateTime to Australia Local DateTime Conversion (Melbourne, Victoria) and we need to consider Daylight Saving which starts every Year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours
    from Daylight Saving Start Date to Daylight Saving End Date which finishes on 1st Sunday of April Month every Year.
    Other that Daylight Saving Time Difference between UTC and VIC loacal time is 10 Hours. So Non Daylight Starts on
    1st Sunday of April Month every Year and ends on October first Sunday every Year.
    Note: On first Sunday of October Month at 2 AM, Our System Time moves 1 hour ahead so It displays 3 AM. Our Wrist Watch, you adjust manually and we make 1 hour ahead. So Technically Time between 2 AM to 2:59:59:599 does not exists in
    Melbourne and 2 AM means 3 AM and 2:10 AM means 3:10 AM Etc
    http://www.timeanddate.com/worldclock/converter.html
    http://www.business.vic.gov.au/operating-a-business/how-to-start/trading-hours/daylight-saving
    http://www.world-time.com.au/index.php?option=com_content&view=article&id=12&Itemid=4
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Hi Guys,
    To convert data from UTC to Local, I used Custom table and I defined 4 columns DAYLIGHT_START_DT, DAYLIGHT_END_DT, AEST_START_DT and AEST_END_DT.
    and Wrote below function to get conversion.
    --Function to Convert UTC to Local
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE Function [dbo].[UTCtoCurrentTime]
           @date datetime
    Returns datetime
    As 
    Begin
    Declare @OUTPUT datetime
    SET @OUTPUT=
    SELECT 
           CASE WHEN @date BETWEEN [DAYLIGHT_START_DT_UTC] AND [DAYLIGHT_END_DT_UTC] 
                THEN DATEADD(hh,[HOURS_DIFF_DURING_DAYLIGHT],@date)
    WHEN @date>[DAYLIGHT_END_DT_UTC] AND @date<=[AEST_END_DT_UTC] 
    THEN DATEADD(hh,[HOURS_DIFF_DURING_AEST],@date)
    END 
    FROM [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE]
    WHERE [AEST_END_DT] IS NOT NULL 
    AND ((@date BETWEEN [DAYLIGHT_START_DT_UTC] AND [DAYLIGHT_END_DT_UTC]) OR (@date>[DAYLIGHT_END_DT_UTC] AND @date<=[AEST_END_DT_UTC] ))
    Return @OUTPUT
    End
    GO
    --Function to Convert Local to UTC
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE Function [dbo].[CurrentTimeToUTC]
           @date datetime
    Returns datetime
    As 
    Begin
    Declare @OUTPUT datetime
    SET @OUTPUT=
    SELECT 
           CASE WHEN @date BETWEEN [DAYLIGHT_START_DT_LOCAL] AND [DAYLIGHT_END_DT_LOCAL] 
                THEN DATEADD(hh,-1*[HOURS_DIFF_DURING_DAYLIGHT],@date)
    WHEN @date>[DAYLIGHT_END_DT_LOCAL] AND @date<=[AEST_END_DT_LOCAL] 
    THEN DATEADD(hh,-1*[HOURS_DIFF_DURING_AEST],@date)
    END 
    FROM [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE]
    WHERE [AEST_END_DT] IS NOT NULL 
    AND ((@date BETWEEN [DAYLIGHT_START_DT_LOCAL] AND [DAYLIGHT_END_DT_LOCAL]) OR (@date>[DAYLIGHT_END_DT_LOCAL] AND @date<=[AEST_END_DT_LOCAL] ))
    Return @OUTPUT
    End
    GO
    But I made a mistake When Storing data into my Table [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE]. As I have to Convert from UTC to Local So I have to Store data into UCT format but I stored into Local DateTime format and then I was getting wrong output
    for boundaries values.
    But once I realized, I changed the Table Structure and added column for UTC and LOCAL both
    DAYLIGHT_START_DT_UTC, DAYLIGHT_START_DT_LOCAL, DAYLIGHT_END_DT_UTC, DAYLIGHT_END_DT_LOCAL, AEST_START_DT_UTC, AEST_START_DT_LOCAL, AEST_END_DT_UTC & AEST_END_DT_LOCAL
    and then above Functions were working perfectly.
    Here is complete data and Table Structure:
    SET
    ANSI_NULLS ON
    GO
    SET
    QUOTED_IDENTIFIER ON
    GO
    SET
    ANSI_PADDING ON
    GO
    CREATE
    TABLE
    [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE](
    [YEAR] [int]
    NOT NULL,
    [DAYLIGHT_START_DAY] [varchar](15)
    NOT NULL,
    [DAYLIGHT_START_DT_UTC]
    [datetime] NOT NULL,
    [DAYLIGHT_START_DT_LOCAL]
    [datetime] NOT NULL,
    [DAYLIGHT_END_DT_UTC] [datetime]
    NOT NULL,
    [DAYLIGHT_END_DT_LOCAL]
    [datetime] NOT NULL,
    [HOURS_DIFF_DURING_DAYLIGHT]
    [tinyint] NOT NULL,
    [AEST_START_DT_UTC] [datetime]
    NULL,
           [AEST_START_DT_LOCAL]
    [datetime] NULL,
    [AEST_END_DT_UTC] [datetime]
    NULL,
    [AEST_END_DT_LOCAL] [datetime]
    NULL,
    [HOURS_DIFF_DURING_AEST]
    [tinyint] NULL,
    [REC_UPDT_USER] [varchar](30)
    NOT NULL,
    [REC_LOAD_DT] [datetime]
    NOT NULL,
    [COMMENTS] [varchar](200)
    NULL
    ON [PRIMARY]
    GO
    SET
    ANSI_PADDING OFF
    GO
    ALTER
    TABLE
    [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE]
    ADD  DEFAULT
    (getdate())
    FOR [REC_LOAD_DT]
    GO
    YEAR
    DAYLIGHT_START_DAY
    DAYLIGHT_START_DT_UTC
    DAYLIGHT_START_DT_LOCAL
    DAYLIGHT_END_DT_UTC
    DAYLIGHT_END_DT_LOCAL
    HOURS_DIFF_DURING_DAYLIGHT
    AEST_START_DT_UTC
    AEST_START_DT_LOCAL
    AEST_END_DT_UTC
    AEST_END_DT_LOCAL
    HOURS_DIFF_DURING_AEST
    REC_UPDT_USER
    REC_LOAD_DT
    COMMENTS
    2005
    Sunday
    2005-29-10 16:00:00
    2005-30-10 2:00:00
    2006-01-04 17:00:00
    2006-02-04 3:00:00
    11
    2006-01-04 17:00:01
    2006-02-04 3:00:01
    2006-30-09 15:59:59
    2006-01-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:51:23
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2006
    Sunday
    2006-30-09 16:00:00
    2006-01-10 2:00:00
    2007-31-03 17:00:00
    2007-01-04 3:00:00
    11
    2007-31-03 17:00:01
    2007-01-04 3:00:01
    2007-06-10 15:59:59
    2007-07-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:46:48
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2007
    Sunday
    2007-06-10 16:00:00
    2007-07-10 2:00:00
    2008-05-04 17:00:00
    2008-06-04 3:00:00
    11
    2008-05-04 17:00:01
    2008-06-04 3:00:01
    2008-04-10 15:59:59
    2008-05-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:46:06
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2008
    Sunday
    2008-04-10 16:00:00
    2008-05-10 2:00:00
    2009-04-04 17:00:00
    2009-05-04 3:00:00
    11
    2009-04-04 17:00:01
    2009-05-04 3:00:01
    2009-03-10 15:59:59
    2009-04-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:44:47
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2009
    Sunday
    2009-03-10 16:00:00
    2009-04-10 2:00:00
    2010-03-04 17:00:00
    2010-04-04 3:00:00
    11
    2010-03-04 17:00:01
    2010-04-04 3:00:01
    2010-02-10 15:59:59
    2010-03-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:41:48
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2010
    Sunday
    2010-02-10 16:00:00
    2010-03-10 2:00:00
    2011-02-04 17:00:00
    2011-03-04 3:00:00
    11
    2011-02-04 17:00:01
    2011-03-04 3:00:01
    2011-01-10 15:59:59
    2011-02-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:34:16
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2011
    Sunday
    2011-01-10 16:00:00
    2011-02-10 2:00:00
    2012-31-03 17:00:00
    2012-01-04 3:00:00
    11
    2012-31-03 17:00:01
    2012-01-04 3:00:01
    2012-06-10 15:59:59
    2012-07-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:35:39
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2012
    Sunday
    2012-06-10 16:00:00
    2012-07-10 2:00:00
    2013-06-04 17:00:00
    2013-07-04 3:00:00
    11
    2013-06-04 17:00:01
    2013-07-04 3:00:01
    2013-05-10 15:59:59
    2013-06-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:36:22
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2013
    Sunday
    2013-05-10 16:00:00
    2013-06-10 2:00:00
    2014-05-04 17:00:00
    2014-06-04 3:00:00
    11
    2014-05-04 17:00:01
    2014-06-04 3:00:01
    2014-04-10 15:59:59
    2014-05-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:37:31
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2014
    Sunday
    2014-04-10 16:00:00
    2014-05-10 2:00:00
    2015-04-04 17:00:00
    2015-05-04 3:00:00
    11
    2015-04-04 17:00:01
    2015-05-04 3:00:01
    2015-03-10 15:59:59
    2015-04-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:39:08
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2015
    Sunday
    2015-03-10 16:00:00
    2015-04-10 2:00:00
    2016-02-04 17:00:00
    2016-03-04 3:00:00
    11
    2016-02-04 17:00:01
    2016-03-04 3:00:01
    2016-01-10 15:59:59
    2016-02-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:44:31
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2016
    Sunday
    2016-01-10 16:00:00
    2016-02-10 2:00:00
    2017-01-04 17:00:00
    2017-02-04 3:00:00
    11
    2017-01-04 17:00:01
    2017-02-04 3:00:01
    2017-30-09 15:59:59
    2017-01-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:44:57
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2017
    Sunday
    2017-30-09 16:00:00
    2017-01-10 2:00:00
    2018-31-03 17:00:00
    2018-01-04 3:00:00
    11
    2018-31-03 17:00:01
    2018-01-04 3:00:01
    2018-06-10 15:59:59
    2018-07-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:48:12
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2018
    Sunday
    2018-06-10 16:00:00
    2018-07-10 2:00:00
    2019-06-04 17:00:00
    2019-07-04 3:00:00
    11
    2019-06-04 17:00:01
    2019-07-04 3:00:01
    2019-05-10 15:59:59
    2019-06-10 1:59:59
    10
    ABC\shivendoo.kumar
    2013-18-11 16:48:44
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2019
    Sunday
    2019-05-10 16:00:00
    2019-06-10 2:00:00
    2020-04-04 17:00:00
    2020-05-04 3:00:00
    11
    2020-04-04 17:00:01
    2020-05-04 3:00:01
    2020-03-10 15:59:59
    2020-04-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:55:54
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2020
    Sunday
    2020-03-10 16:00:00
    2020-04-10 2:00:00
    2021-03-04 17:00:00
    2021-04-04 3:00:00
    11
    2021-03-04 17:00:01
    2021-04-04 3:00:01
    2021-02-10 15:59:59
    2021-03-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:56:48
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2021
    Sunday
    2021-02-10 16:00:00
    2021-03-10 2:00:00
    2022-02-04 17:00:00
    2022-03-04 3:00:00
    11
    2022-02-04 17:00:01
    2022-03-04 3:00:01
    2022-01-10 15:59:59
    2022-02-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:58:01
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2022
    Sunday
    2022-01-10 16:00:00
    2022-02-10 2:00:00
    2023-01-04 17:00:00
    2023-02-04 3:00:00
    11
    2023-01-04 17:00:01
    2023-02-04 3:00:01
    2023-30-09 15:59:59
    2023-01-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 16:59:55
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2023
    Sunday
    2023-30-09 16:00:00
    2023-01-10 2:00:00
    2024-06-04 17:00:00
    2024-07-04 3:00:00
    11
    2024-06-04 17:00:01
    2024-07-04 3:00:01
    2024-05-10 15:59:59
    2024-06-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 17:00:30
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    2024
    Sunday
    2024-05-10 16:00:00
    2024-06-10 2:00:00
    2025-05-04 17:00:00
    2025-06-04 3:00:00
    11
    2025-05-04 17:00:01
    2025-06-04 3:00:01
    2025-04-10 15:59:59
    2025-05-10 1:59:59
    10
    ABC\shivendoo.kumar
    2014-14-02 17:02:06
    Day light saving starts each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2010, N'Sunday', CAST(0x00009E030107AC00 AS DateTime), CAST(0x00009E040020F580 AS DateTime), CAST(0x00009EB9011826C0 AS DateTime), CAST(0x00009EBA00317040 AS
    DateTime), 11, CAST(0x00009EB9011827EC AS DateTime), CAST(0x00009EBA0031716C AS DateTime), CAST(0x00009F6F0107AAD4 AS DateTime), CAST(0x00009F700020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0111154E AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2011, N'Sunday', CAST(0x00009F6F0107AC00 AS DateTime), CAST(0x00009F700020F580 AS DateTime), CAST(0x0000A025011826C0 AS DateTime), CAST(0x0000A02600317040 AS
    DateTime), 11, CAST(0x0000A025011827EC AS DateTime), CAST(0x0000A0260031716C AS DateTime), CAST(0x0000A0E20107AAD4 AS DateTime), CAST(0x0000A0E30020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A01117620 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2012, N'Sunday', CAST(0x0000A0E20107AC00 AS DateTime), CAST(0x0000A0E30020F580 AS DateTime), CAST(0x0000A198011826C0 AS DateTime), CAST(0x0000A19900317040 AS
    DateTime), 11, CAST(0x0000A198011827EC AS DateTime), CAST(0x0000A1990031716C AS DateTime), CAST(0x0000A24E0107AAD4 AS DateTime), CAST(0x0000A24F0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0111A8A7 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2013, N'Sunday', CAST(0x0000A24E0107AC00 AS DateTime), CAST(0x0000A24F0020F580 AS DateTime), CAST(0x0000A304011826C0 AS DateTime), CAST(0x0000A30500317040 AS
    DateTime), 11, CAST(0x0000A304011827EC AS DateTime), CAST(0x0000A3050031716C AS DateTime), CAST(0x0000A3BA0107AAD4 AS DateTime), CAST(0x0000A3BB0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0111FA72 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2014, N'Sunday', CAST(0x0000A3BA0107AC00 AS DateTime), CAST(0x0000A3BB0020F580 AS DateTime), CAST(0x0000A470011826C0 AS DateTime), CAST(0x0000A47100317040 AS
    DateTime), 11, CAST(0x0000A470011827EC AS DateTime), CAST(0x0000A4710031716C AS DateTime), CAST(0x0000A5260107AAD4 AS DateTime), CAST(0x0000A5270020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A01126BB7 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2015, N'Sunday', CAST(0x0000A5260107AC00 AS DateTime), CAST(0x0000A5270020F580 AS DateTime), CAST(0x0000A5DC011826C0 AS DateTime), CAST(0x0000A5DD00317040 AS
    DateTime), 11, CAST(0x0000A5DC011827EC AS DateTime), CAST(0x0000A5DD0031716C AS DateTime), CAST(0x0000A6920107AAD4 AS DateTime), CAST(0x0000A6930020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0113E61E AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2016, N'Sunday', CAST(0x0000A6920107AC00 AS DateTime), CAST(0x0000A6930020F580 AS DateTime), CAST(0x0000A748011826C0 AS DateTime), CAST(0x0000A74900317040 AS
    DateTime), 11, CAST(0x0000A748011827EC AS DateTime), CAST(0x0000A7490031716C AS DateTime), CAST(0x0000A7FE0107AAD4 AS DateTime), CAST(0x0000A7FF0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0114042C AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2017, N'Sunday', CAST(0x0000A7FE0107AC00 AS DateTime), CAST(0x0000A7FF0020F580 AS DateTime), CAST(0x0000A8B4011826C0 AS DateTime), CAST(0x0000A8B500317040 AS
    DateTime), 11, CAST(0x0000A8B4011827EC AS DateTime), CAST(0x0000A8B50031716C AS DateTime), CAST(0x0000A9710107AAD4 AS DateTime), CAST(0x0000A9720020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A0114E983 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2018, N'Sunday', CAST(0x0000A9710107AC00 AS DateTime), CAST(0x0000A9720020F580 AS DateTime), CAST(0x0000AA27011826C0 AS DateTime), CAST(0x0000AA2800317040 AS
    DateTime), 11, CAST(0x0000AA27011827EC AS DateTime), CAST(0x0000AA280031716C AS DateTime), CAST(0x0000AADD0107AAD4 AS DateTime), CAST(0x0000AADE0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A27A01150E75 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2009, N'Sunday', CAST(0x00009C970107AC00 AS DateTime), CAST(0x00009C980020F580 AS DateTime), CAST(0x00009D4D011826C0 AS DateTime), CAST(0x00009D4E00317040 AS
    DateTime), 11, CAST(0x00009D4D011827EC AS DateTime), CAST(0x00009D4E0031716C AS DateTime), CAST(0x00009E030107AAD4 AS DateTime), CAST(0x00009E040020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D20113268C AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2008, N'Sunday', CAST(0x00009B2B0107AC00 AS DateTime), CAST(0x00009B2C0020F580 AS DateTime), CAST(0x00009BE1011826C0 AS DateTime), CAST(0x00009BE200317040 AS
    DateTime), 11, CAST(0x00009BE1011827EC AS DateTime), CAST(0x00009BE20031716C AS DateTime), CAST(0x00009C970107AAD4 AS DateTime), CAST(0x00009C980020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D20113F95D AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2007, N'Sunday', CAST(0x000099BF0107AC00 AS DateTime), CAST(0x000099C00020F580 AS DateTime), CAST(0x00009A75011826C0 AS DateTime), CAST(0x00009A7600317040 AS
    DateTime), 11, CAST(0x00009A75011827EC AS DateTime), CAST(0x00009A760031716C AS DateTime), CAST(0x00009B2B0107AAD4 AS DateTime), CAST(0x00009B2C0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D201145531 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2006, N'Sunday', CAST(0x0000984C0107AC00 AS DateTime), CAST(0x0000984D0020F580 AS DateTime), CAST(0x00009902011826C0 AS DateTime), CAST(0x0000990300317040 AS
    DateTime), 11, CAST(0x00009902011827EC AS DateTime), CAST(0x000099030031716C AS DateTime), CAST(0x000099BF0107AAD4 AS DateTime), CAST(0x000099C00020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D201148683 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2005, N'Sunday', CAST(0x000096FC0107AC00 AS DateTime), CAST(0x000096FD0020F580 AS DateTime), CAST(0x00009796011826C0 AS DateTime), CAST(0x0000979700317040 AS
    DateTime), 11, CAST(0x00009796011827EC AS DateTime), CAST(0x000097970031716C AS DateTime), CAST(0x0000984C0107AAD4 AS DateTime), CAST(0x0000984D0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D20115C908 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2019, N'Sunday', CAST(0x0000AADD0107AC00 AS DateTime), CAST(0x0000AADE0020F580 AS DateTime), CAST(0x0000AB93011826C0 AS DateTime), CAST(0x0000AB9400317040 AS
    DateTime), 11, CAST(0x0000AB93011827EC AS DateTime), CAST(0x0000AB940031716C AS DateTime), CAST(0x0000AC490107AAD4 AS DateTime), CAST(0x0000AC4A0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D2011706AB AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2020, N'Sunday', CAST(0x0000AC490107AC00 AS DateTime), CAST(0x0000AC4A0020F580 AS DateTime), CAST(0x0000ACFF011826C0 AS DateTime), CAST(0x0000AD0000317040 AS
    DateTime), 11, CAST(0x0000ACFF011827EC AS DateTime), CAST(0x0000AD000031716C AS DateTime), CAST(0x0000ADB50107AAD4 AS DateTime), CAST(0x0000ADB60020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D2011745D9 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2021, N'Sunday', CAST(0x0000ADB50107AC00 AS DateTime), CAST(0x0000ADB60020F580 AS DateTime), CAST(0x0000AE6B011826C0 AS DateTime), CAST(0x0000AE6C00317040 AS
    DateTime), 11, CAST(0x0000AE6B011827EC AS DateTime), CAST(0x0000AE6C0031716C AS DateTime), CAST(0x0000AF210107AAD4 AS DateTime), CAST(0x0000AF220020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D201179BCA AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2022, N'Sunday', CAST(0x0000AF210107AC00 AS DateTime), CAST(0x0000AF220020F580 AS DateTime), CAST(0x0000AFD7011826C0 AS DateTime), CAST(0x0000AFD800317040 AS
    DateTime), 11, CAST(0x0000AFD7011827EC AS DateTime), CAST(0x0000AFD80031716C AS DateTime), CAST(0x0000B08D0107AAD4 AS DateTime), CAST(0x0000B08E0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D201182176 AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2023, N'Sunday', CAST(0x0000B08D0107AC00 AS DateTime), CAST(0x0000B08E0020F580 AS DateTime), CAST(0x0000B14A011826C0 AS DateTime), CAST(0x0000B14B00317040 AS
    DateTime), 11, CAST(0x0000B14A011827EC AS DateTime), CAST(0x0000B14B0031716C AS DateTime), CAST(0x0000B2000107AAD4 AS DateTime), CAST(0x0000B2010020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D2011849FB AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    INSERT [DBO].[AUSTRALIA_DAYLIGHT_SAVING_TABLE] ([YEAR], [DAYLIGHT_START_DAY], [DAYLIGHT_START_DT_UTC], [DAYLIGHT_START_DT_LOCAL], [DAYLIGHT_END_DT_UTC], [DAYLIGHT_END_DT_LOCAL], [HOURS_DIFF_DURING_DAYLIGHT], [AEST_START_DT_UTC], [AEST_START_DT_LOCAL], [AEST_END_DT_UTC],
    [AEST_END_DT_LOCAL], [HOURS_DIFF_DURING_AEST], [REC_UPDT_USER], [REC_LOAD_DT], [COMMENTS]) VALUES (2024, N'Sunday', CAST(0x0000B2000107AC00 AS DateTime), CAST(0x0000B2010020F580 AS DateTime), CAST(0x0000B2B6011826C0 AS DateTime), CAST(0x0000B2B700317040 AS
    DateTime), 11, CAST(0x0000B2B6011827EC AS DateTime), CAST(0x0000B2B70031716C AS DateTime), CAST(0x0000B36C0107AAD4 AS DateTime), CAST(0x0000B36D0020F454 AS DateTime), 10, N'ABC\shivendoo.kumar', CAST(0x0000A2D20118BA9A AS DateTime), N'Day light saving starts
    each year October first Sunday so Time difference between UTC and AUS Local Time will be 11 hours from startdate')
    GO
    Thanks Shiven:) If Answer is Helpful, Please Vote

  • XML DateTime conversion in C#

    I have an XML document where the datetime format is;
    "Wed May 08 2007 00:00:00 GMT-0600" and I need to convert it in C# to any DateTime as long as it works in C#....Help Please Andy

    Try:
    SELECT CONVERT(varchar,CONVERT(smalldatetime, '3/22/2010 4:28:23 PM', 101),101)+
    SPACE(1)+
    LEFT(CONVERT(varchar,CONVERT(smalldatetime, '3/22/2010 4:28:23 PM', 101),108),5);
    -- 03/22/2010 16:28
    Datetime conversions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Datatype conversion and Range

    Ok here i am back again..
    I am creating a database upgrade tool,
    the column types are also subject to change.
    I use the CAST(col_name AS newtype) function to cast types,
    this often works. But not for all cases.
    @see http://download-west.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90125/functions15.htm
    For example a change from VARCHAR(255) to CHAR(3) does not work if the row currently
    contains a row with more than 3 character.
    A simple conversion that solves this problem is:
    CAST(CAST(col_name AS VARCHAR(3)) AS CHAR(3))
    I tested it using the following statement:
    select CAST(CAST('wtfomgbbq' AS VARCHAR(3)) AS CHAR(3)) from dual;
    Does this always work?
    Some type changes can be done directly on a table like this:
    ALTER TABLE table_name MODIFY ( col_name <NEWTYPE>)
    But this only works if the range is either the same or increased,
    or the table does not contain any rows, or the columns has only null values.
    (i checked the reference)
    But is there a way to always use this MODIFY statement and force the data to be transformed to the new type?
    My current approach is to create a temporary table, drop the current table, and recreate the current (with correct schema) and put the old data in the new table using the CAST function as described above.
    Maybe you experts now some way to do this faster?
    And how can i handle range decreases without getting oracle errors?
    (the update process may take several hours, so the DBA does not want an error message when updating the database)

    It would be easier as you still have to convert the output of SUBSTR to CHAR(3), else you are doing an implicit type conversion... Which is not bad, but i really want to be explicit:
    CAST(SUBSTR(col1, 1, 3) AS CHAR(3))
    Note that the sql code that does the type conversions is automatically generated, so it doesnt matter if it looks more complex.
    Anyway the main problem question is:
    Can i always use ALTER TABLE MODIFY to modify the data types of columns or do i have to use temporary cols, or temporary tables?
    Isnt there an option to force data type conversions and let oracle handle the casting (ans loss of data if the data-range is decreased) ?
    Thanks in advance

  • DATE vs DATETIME conversion

    I am running into a strange issue which is preventing me to finish my project. Any help would be greatly appreciated. 
    It looks like the CONVERT (the same goes for CAST) function treats DATE and DATETIME conversions differently when executed by a user with the Dutch language settings.
    Here is what I mean, I run the following query:
    SELECT CONVERT(DATE, '2014-09-01 23:00:00'), CONVERT(DATETIME, '2014-09-01 23:00:00')
    The results are:
    2014-09-01, 2014-01-09 23:00:00
    The conversion to DATETIME swapped the month and the day around, while this doesn't happen for the DATE conversion. The DATE conversion is the correct format, since I supplied it YYYY-MM-DD HH:mm:ss.
    When I run the same query using a user with the default language settings (en-US I assume) the same query works fine (no swapping of month and day values). 
    Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? 
     

    >> Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? <<
    CONVERT() is an old Sybase string function. It was created to keep 960's COBOL programmers happy since SQL does not have a PICTURE clause to put data in display formats. 
    CAST() is the ANSI/ISO Standard function to convert data types and this is what you should be using. It is not a string function. It uses the ISO-8601 standard for dates (yyyy-mm-dd), as you have seen. This is the only -– repeat, only! -- format allowed in
    SQL. Microsoft is a few decades behind and trying to catch up now.
    A good SQL programmer will do any local display formatting in the presentation, which will handle local languages that are never used in the database. Want to have some fun? The names of months in Polish, Czech, Croatian, Ukrainian and Belarusian not based
    on the Latin names used in most European languages. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Converting varchar to datetime 103

    Hi Guys
    Im making a select query where in a colomn the date is yyyy-mm-dd, i need dd-mm-yyyy (103). A simple convert query does not work because the colomn is not set as a datetime but as a varchar. Its not possible to change the tables at the source.
    The colomn name is DATE_IN
    I think the following post could be helpfull but i dont know how to fix the given statements into the select query
    http://stackoverflow.com/questions/1509977/convert-varchar-into-datetime-in-sql-server

    > in a colomn the date is yyyy-mm-dd, i need dd-mm-yyyy (103)
    As suggested above, this is string date format to string date format conversion, purely string operations.
    If you convert to DATE / DATETIME first (universal internal binary representation), then it may fail if invalid date. 
    You can use the ISDATE or TRY_CONVERT functions to check if the string date is valid.
    DATETIME functions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Convert DocTime to datetime type and format of HH:MM

    Hi Experts!!
    I am setting up an alert that will run every 5 minutes but would like only those docs created in the last 5 to be selected. In order to accomplish this i would like to use the DATEDIFF funtion. But have a problem in that the DocTime is a smallint (why it's not a datetime is beyond me!) How do I convert it to the proper datetime type and format?
    Thx
    Richard

    Hi Richard,
    check with this just change date smallint to datetime
    select
    (select case when len(oi.doctime)=3 then
    convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,1)) + ':'+ (right(oi.doctime,2))) ,114),103) else
    convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,2)) + ':'+ (right(oi.doctime,2))) ,114),103) end) as PreparationTime
    from oinv oi

  • TWO CRITICAL BUGS: 1) File, "Save Page As" and 2) right-click the picture and select "Save Image As", both do not work at all in Firefox 27, 28, and 29!

    Note: capitals are used only to highlight important words.
    PLEASE, TAKE THESE COMMENTS ON TWO CRITICAL BUGS VERY SERIOUSLY BECAUSE THE BUGS DESCRIBED BELOW ARE SO CRITICAL THAT I CANNOT USE THE LATEST VERSION OF FIREFOX UNLESS THEY DO NOT APPEAR IN THE LATEST VERSION AND THEREFORE I AM FORCED TO REVERT BACK TO FIREFOX 26.
    I have Windows 7 64-bit and Firefox 26. I could not install Firefox 27, 28, and 29 due to the persistent presence of the two critical bugs described below. I have 8 GB of RAM and an Intel quad-core processor and a lot of hard disk space available.
    I installed Firefox 27 and then Firefox 28 a while back and these two bugs described below were still present and now I have just checked again with Firefox 29 by installing it and yet again, these two bugs described below are present!! UNBELIEVABLE THAT THESE TWO CRITICAL BUGS ARE STILL PRESENT IN FIREFOX 29 WHEN I CLEARLY INFORMED YOU ABOUT THEM IN THE HELP, SUBMIT LINK OF FIREFOX!!
    I am forced to revert to Firefox 26!
    First, I use Windows 7 64-bit and I always use Firefox with at least 120 tabs opened. BUT I have 8 GB of RAM, an Intel core i7 quad-core processor and more than 1 TB of hard disk space. Consequently, I do not understand why I would have these two critical bugs.
    With Firefox 26, I also have at least 120 tabs opened when I start Firefox and I do not have the two critical bugs described below, therefore I do not believe that the number of tabs is the reason of the two critical bugs that are present in Firefox 27, 28, and 29.
    ---FIRST CRITICAL BUG:
    When I open ANY web page and do File, "Save Page As", the window that is supposed to open to locate the folder where I want to save this web page does NOT open at all, even if I wait a long time to see if it opens.
    Same problem happened with Firefox 27, 28, and now 29!! When I reverted back to Firefox 26, this problem did NOT happen anymore!
    ---SECOND CRITICAL BUG:
    When I use Google Images, for instance entering model in the search field of Google Images and then pressing enter.
    Then I select any picture, open to a new tab this selected picture, then open a new tab by selecting the option View for this picture. Then right-click the picture and select "Save Image As".
    Again, the window that is supposed to open to locate the folder where I want to save this picture does NOT open at all, even if I wait a long time to see if it opens.
    Same problem happened with Firefox 27, 28, and now 29!! When I reverted back to Firefox 26, this problem did NOT happen anymore!
    ---THESE TWO CRITICAL BUGS DO NOT APPEAR WHEN I USE INTERNET EXPLORER 11.
    I have no idea if you will be able to reproduce these two critical BUGS but I can assure you that they are not present when I use Firefox 26 and they are present when I use Firefox 27, 28, and 29. More, be aware that I have at least 100 tabs opened but I also have this same number of tabs opened in Firefox 26 and yet I do not experience these two critical bugs when I have Firefox 26!
    Once again, these two bugs touch at two vital, critical very basic functions of Firefox and therefore I will NOT be able to use any version above 26 if these two bugs are still present, as they are present in Firefox 27, 28, and now 29!!!
    Please, make it a priority to solve these two critical bugs. Thanks.
    I did read a post related to the same issues “Firefox stops responding when trying to "save page" or "save image" | Firefox Support Forum | Mozilla Support” at https://support.mozilla.org/en-US/questions/991630?esab=a&as=aaq
    I am still reading it again to try to figure out exactly what the person did to make his problems be solved, as the post is not clear at all on what solved the problems!
    In any case, all the suggestions proposed in this post do not work and I surely cannot do a system restore when it is obvious that the two bugs do not appear in Internet Explorer.

    First, I sent an email to the author of PhotoME to inform him of the serious issues his addon caused with Firefox latest versions.
    Now, for those of you who do not have the PhotoME addon and yet experience the same problem that I had and that I described above, I suggest the following strategy.
    As PhotoME did cause these problems with Firefox latest versions, I am pretty covinved other addons probably might cause these problems too. Therefore, adopt the following method.
    Test one addon at a time to see if this particular addon is behind your Firefox issues like the ones I had.
    So, disable one addon only at a time. Then close your Firefox and restart it from scratch and see if you still have your Firefox problems. You must restart the Firefox browser from scratch. If you still have these Firefox problems, re-enable the disabled addon, restart your Firefox (again!) and repeat the same method for every single addon that you have.
    Try to be selective by choosing first addons that are more likely to cause your Firefox problems such as not very well-known or not very popular addons (like it was the case for the PhotoME addon).
    If this method works or if it does not work, report it on this web page so that others can be helped with your comments.
    I hope this method will help you because I was really upset that I had these Firefox problems and I first thought it was the fault of Firefox, only to discover later that this PhotoME addon was the culprit and had caused me such upset.

  • Using Audition 2.0 on Windows XP platform.  Now have Windows 8.1 on new computer and need to upgrade and load latest version of Audition.  Any suggestions?  Thanks very much.....R

    Using Audition 2.0 on Windows XP platform.  Now have Windows 8.1 on new computer and need to upgrade and load latest version of Audition.  Any suggestions?  Many thanks, R.

    VC6. is rather old, but you can try to convert the VC6 project using the upgrade wizard of VC2012. Depending on the content of the project your code will work more or less without problems, at least it will compile without errors.
    You could also go the 2nd way and create in VC2012 a project type using the wizard that is very similar to your current VC6 projcet (MDI, SDI, Dialog Based, ...). Than you replace the files generated by the wizard with the content of your project. Sometimes
    this way is more successful.
    But at all the automated converting success depends on the code of your VC6 project. I had both, conversions without big problems and also conversions that need a lot changes to run on a current VC version.
    Best regards
    Bordon
    Note: Posted code pieces may not have a good programming style and may not perfect. It is also possible that they do not work in all situations. Code pieces are only indended to explain something particualar.

Maybe you are looking for