我遇到了一个小问题。我正在插入/更新2k以上的记录,在2k内,可能会有一些我已有的记录。我曾经可能需要更新原始记录等。
该解决方案使用SQL Compact,它可以在慢速计算机上运行。我确实有一个方法,但花了10多分钟。 (太长了)。
所以现在我在临时表中进行批量插入,然后我可以从temp到原始插入。
我的更新脚本似乎有问题。下面的脚本适用于SQL Server,但是当我尝试使用相同的脚本(具有相同的数据库架构等)时,它不起作用。
有人可以帮忙吗?
UPDATE Clients
SET Title = Temp_Clients.Title
,Forename = Temp_Clients.Forename
,Surname = Temp_Clients.Surname
,DOB = Temp_Clients.DOB
,IsMale = Temp_Clients.IsMale
,Address1 = Temp_Clients.Address1
,Address2 =Temp_Clients.Address2
,Address3 = Temp_Clients.Address3
,Town = Temp_Clients.Town
,County = Temp_Clients.County
,Postcode = Temp_Clients.Postcode
,Telephone = Temp_Clients.Telephone
,Mobile = Temp_Clients.Mobile
,Email =Temp_Clients.Email
,LocationID = Temp_Clients.LocationID
,GpPractice = Temp_Clients.GpPractice
,GpName = Temp_Clients.GpName
FROM Temp_Clients
INNER JOIN Clients AS A ON A.[CustomClientID] = Temp_Clients.[CustomClientID]
答案 0 :(得分:0)
我认为你的错误方法是:首先应该是客户端然后加入temp_clients。
UPDATE Clients
SET Title = Temp_Clients.Title
,Forename = Temp_Clients.Forename
,Surname = Temp_Clients.Surname
,DOB = Temp_Clients.DOB
,IsMale = Temp_Clients.IsMale
,Address1 = Temp_Clients.Address1
,Address2 =Temp_Clients.Address2
,Address3 = Temp_Clients.Address3
,Town = Temp_Clients.Town
,County = Temp_Clients.County
,Postcode = Temp_Clients.Postcode
,Telephone = Temp_Clients.Telephone
,Mobile = Temp_Clients.Mobile
,Email =Temp_Clients.Email
,LocationID = Temp_Clients.LocationID
,GpPractice = Temp_Clients.GpPractice
,GpName = Temp_Clients.GpName
FROM Clients INNER JOIN Temp_Clients ON Clients.[CustomClientID] = Temp_Clients.[CustomClientID]