How to Concat Datetime without Losing Second Precision What is best way to Concat on datetime column with other fields, without losing/truncate millisecond precision?

Example: We have a column in datetime precision.

1988-02-27 00:00:04.000


We are creating rowhash on CONCAT

select hashbytes('SHA2_256',concat(SalesRecord,SalesDatetime))


The problem when doing Concat, we are losing second values.
You can test here, 

create table dbo.SalesOrder
(
    SalesOrderId int primary key, 
    SalesRecord varchar(255), 
    SalesDatetime datetime
)
select concat(SalesRecord,SalesDateTime) from dbo.SalesOrder
select concat('ABC ',[SalesDateTime]) from dbo.SalesOrder

ABC Feb 27 1988 12:00AM


What is the optimal way to solve this?

Background: Rowhash was causing duplicates by removing seconds, pipe deliminator | not working either.

The following was not working:

declare @testdate datetime = '1988-02-27 00:00:04.000'
select concat('ABC',convert(binary(16),@testdate)) 
select concat('ABC',convert(varchar(25),@testdate))
You are losing seconds because the default format for converting datetime to string is the same as:

SELECT CONVERT(char(19), GETDATE(), 0);


Which outputs (for me, right now):

Oct 30 2018  2:02PM


You can try something more like this:

SELECT CONCAT
       (
         'ABC ', 
         CONVERT(char(19), GETDATE(), 25)
       );


Which outputs (again, for me, right now):

ABC 2018-10-30 14:02:55


If second aren't enough, just change char(19) to char(23). If that's still not enough, you can consider changing that column to datetime2 to get more precision.