Fehler in SQL server beim Aktualisieren von data

Create Table #tempTbl ( [AssID] [int], [dt] [datetime] ) insert into #tempTbl select distinct(AssignmentID), (case when isdate(substring(NoteText,len('Vehicle picked-up was completed on')+1,len(NoteText)))=1 then substring(NoteText,len('Vehicle picked-up was completed on')+1,len(NoteText)) else '01/01/1900' end) as dop from dbo.Assignment_Notes where AssignmentID in(Select AssignmentID from dbo.Assignment_ClaimInfo where InsuranceComp='Access General') and AssignmentID in (Select AssignmentID from dbo.Assignment_BuyerInfo where PickupDate is null) and NoteTypeID=5 update dbo.Assignment_BuyerInfo set PickupDate=#tempTbl.dt where AssignmentID=#tempTbl.AssID 

   

Ändern Sie Ihre Update-statement wie folgt:

 update dbo.Assignment_BuyerInfo set PickupDate=#tempTbl.dt from dbo.Assignment_BuyerInfo, #tempTbl where AssignmentID=#tempTbl.AssID 

Du musst deine Extra-Tabelle in eine Klausel aufnehmen, genau wie du es wäre, wenn du eine ausgewählte Aussage machst.