date issues in t-sql

Miiimy7 41 Reputation points
2021-03-29T14:16:59.89+00:00

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

82461-image.png

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,552 questions
{count} votes

Accepted answer
  1. Viorel 112.1K Reputation points
    2021-03-29T18:01:16.717+00:00

    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,571 Reputation points
    2021-03-30T06:26:20.04+00:00

    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  
    

    82606-image.png

    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.

    Regards
    Echo


    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.