date issues in t-sql

Miiimy7 41 Reputation points

I can't find the relation between those 2 columns, can you guys help me?


{count} votes

Accepted answer
  1. Viorel 89,396 Reputation points

    It seems possible to identify an approximate relation between date and SecondValueA. Check an example:

    declare @date as datetime2 = cast('2021-03-29 14:12:37.163' as datetime2)
    declare @secondValueA bigint
    declare @x1 datetime2 = cast('2021-03-29 14:10:07.159' as datetime2)
    declare @x2 datetime2 = cast('2021-03-29 14:15:37.162' as datetime2)
    declare @y1 bigint = cast(-232845330 as bigint)
    declare @y2 bigint = cast(-1227785454 as bigint) + cast(0x100000000 as bigint)
    set @secondValueA = @y1 + (@y2 - @y1) * datediff_big(mcs, @x1, @date) / datediff_big(mcs, @x1, @x2)
    if @secondValueA > 0x7FFFFFFF set @secondValueA -= cast(0x100000000 as bigint)
    select @date as [date], @secondValueA as SecondValueA

1 additional answer

Sort by: Most helpful
  1. EchoLiu-MSFT 14,501 Reputation points

    Hi @Miiimy7 ,

    Every 30 seconds SecondvalueA increases by about 299930364:

        select 67219244-(-2328453330)  
        select 367172064-67219244  
        select 667144628-367172064  
        select 967261916-667144628  
        select 1267192280-967261916  


    I'm not sure if the relationship between the two columns you are looking for is a direct link between the data between the two columns.


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.