I need a select from table which does not have column that tells when row was inserted, only timestamp column (values like: 0x0000000000530278). Some data was i
Other people correctly pointed out that the timestamp is a binary counter. Nevertheless, if in any table of your database, you have the timestamp and the datetime when it was recorded, you can use that piece of information to go from any timestamp to a date range. A log table is a good candidate for this purpose. Assuming your import table is "invoices", you could use a query like the following:
WITH TS
AS
(
SELECT
L1.LastDateUpdated, COALESCE(L2.LastDateUpdated, {TS '2099-12-31 00:00:00'}) as LastDateUpdatedTo,
L1.[TIMESTAMP], L2.[TIMESTAMP] as [TIMESTAMPTo]
FROM
(
SELECT L1.[LastDateUpdated]
,L1.[TIMESTAMP]
,ROW_NUMBER() OVER (ORDER BY L1.[LastDateUpdated]) ID
FROM [Log] L1
) L1
left join
(
SELECT L2.[LastDateUpdated]
,L2.[TIMESTAMP]
,ROW_NUMBER() OVER (ORDER BY L2.[LastDateUpdated]) ID
FROM [Log] L2
) L2
ON L1.ID = L2.ID - 1
)
SELECT TS.LastDateUpdated, TS.LastDateUpdatedTo, * from [Invoices]
inner join TS ON [Invoices].Timestamp between TS.Timestamp and
TS.TIMESTAMPTo
ORDER BY TS.TIMESTAMPTo DESC