本文介绍了我怎样才能在merge sql语句中使用cast函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
合并更新
merge update
    ,(CAST(tgt.LastSaleDate as datetime2(0))= src.LastSaleDate)
,(CAST(tgt.LastSaleDate as datetime2(0)) = src.LastSaleDate)
这是更新中的错误
this comes as an error in update
推荐答案
似乎您正在尝试CAST目标表的列。这是不可能的。
It seems that you are trying to CAST a column of a target table. It is impossible to do.
恕我直言,你需要CAST分配给列的值,如下所示:
IMHO, you need to CAST the value assigned to the column, like below:
tgt.LastSaleDate = CAST(src.LastSaleDate AS DATETIME2(0))
这篇关于我怎样才能在merge sql语句中使用cast函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!