sql server 查询数据拼装成update语句

sql server 查询数据成update语句

select top 100 
mkbarcode,
'update  report set reportpath='''+reportpath
+''' where barcode='''+barcode 
+''' and testaimscode='''+ testaimscode
+''' and InspectionCode=''' + InspectionCode
+''' and PatientName='''+PatientName
+''' and sourcekey='''+  CONVERT(VARCHAR(100), sourcekey COLLATE Chinese_PRC_CI_AS)
+''' and sourcetype='''+ CONVERT(VARCHAR(100), sourcetype ) +'''' 
from w_report 
where pdfreportpath like '%userupload%'
 and  reporttime > '2020-07-20' 

你可能感兴趣的:(数据库)