Uday
Uday

Reputation: 1

Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AS"

insert into @temp_traffic_reports(id, assetname,datestamp,messagetype,itemquantity)
(
    select 
        tf.ID as id, 
        ta.TrackingIdentityName as assetname, 
        DATEADD(hour,@TimeZoneValue,Datestamp) as datestamp ,
        'Poll for position report' as messagetype,
        '1' as  itemquantity
FROM trackmaps_WHB.dbo.MESForwardMessage tf
join @temp_assets ta 
    on tf.TerminalID = ta.TrackingIndentity
where 
    Datestamp between DATEADD(hour,@TimeZoneValue,@fDate) and DATEADD(hour,@TimeZoneValue,@tDate)
);

Upvotes: 0

Views: 255

Answers (3)

SAM
SAM

Reputation: 835

insert into @temp_traffic_reports(id, assetname,datestamp,messagetype,itemquantity)
(
    select 
        tf.ID as id, 
        ta.TrackingIdentityName COLLATE SQL_Latin1_General_CP1_CI_AS as assetname , 
        DATEADD(hour,@TimeZoneValue,Datestamp) as datestamp ,
        'Poll for position report' as messagetype,
        '1' as  itemquantity
FROM trackmaps_WHB.dbo.MESForwardMessage tf
join @temp_assets ta 
    on tf.TerminalID = ta.TrackingIndentity
where 
    Datestamp between DATEADD(hour,@TimeZoneValue,@fDate) and DATEADD(hour,@TimeZoneValue,@tDate)

Upvotes: 1

Nguyễn Hải Triều
Nguyễn Hải Triều

Reputation: 1464

insert into @temp_traffic_reports(id, assetname,datestamp,messagetype,itemquantity)
(
    select 
        tf.ID as id, 
        ta.TrackingIdentityName as assetname, 
        DATEADD(hour,@TimeZoneValue,Datestamp) as DATES_STAMP ,
        'Poll for position report' as messagetype,
        '1' as  itemquantity
FROM trackmaps_WHB.dbo.MESForwardMessage tf
join @temp_assets ta 
    on tf.TerminalID = ta.TrackingIndentity
CROSS APPLY (SELECT DATES_STAMP) AS A
 WHERE A.DATES_STAMP between DATEADD(hour,@TimeZoneValue,@fDate) and DATEADD(hour,@TimeZoneValue,@tDate)
)

Upvotes: 0

Plebios
Plebios

Reputation: 835

You have to force one of the two collations in the comparation

Upvotes: 0

Related Questions