Yasir -
Since you have not gone into any details how you are querying the date/time value from SQL Server 2019 and retrieving the value into PB, I have performed some experiments using PB 2017 R3 Build 1915 and SQL Server 2019 via the SNC (OLE DB) native interface.
Below is the SQL SELECT for a test DataWindow that returns a datetime2 value:
If the SELECT statement uses GETDATE() instead of SYSDATETIME(), a datetime value is returned. The time portion of a SQL Server datetime has a resolution of milliseconds (hh:mm:ss.fff) and a datetime2 value provides seven decimal places.
Below is the preview of this DataWindow in the DW Painter:
A time value in PB contains at most six decimal places, so PB drops the seventh decimal place from the datetime2 value supplied by SQL Server.
*** Note ***
I had to alter the default display format for this column object in the DW Painter in order to see the fractional seconds. Normally, the default display format supplied by PB does not include fractional seconds:
If a datetime value is returned in the SELECT statement, only three decimal places are returned:
You can also put a datetime or datetime2 value into a PB datetime variable via inline SQL:
Datetime ldt_now
SELECT GETDATE()
INTO :ldt_now
FROM (SELECT 1 AS [a_column] AS [dummy_table])
USING SQLCA;
I'm not sure why you think PB is not able to obtain the fractional seconds from SQL Server, but I'm guessing it's because you do not see the fractional seconds displayed in the PB debugger or in a DW column because of the display format:
Remember I stated earlier that PB uses a default display format that omits the fractional seconds... The fractional seconds ARE there:
I hope this helps to resolve your question.
Best regards, John