最近在做将excel文件中的数据导入到数据库表中时候出现重复导入的问题
利用checksum函数,写法如下:
if not exists
(select * from dbo.ZHJZX_Vouch_YS where checksum(cShipNo,cAWBNo,cDwCode)=
checksum('新南沙 0103N','CSVXTTJA8610','AFJSFS')
and cShipNo='新南沙 0103N' and cAWBNo='CSVXTTJA8610' and cDwCode='AFJSFS')
insert into dbo.ZHJZX_Vouch_YS(iID,cShipNo,cAWBNo,cDwCode)
values(1,'新南沙 0103N','CSVXTTJA8610','AFJSFS')