2013-08-22 178 views
1

這是我的存儲過程用於更新SQL Server中的表,但我似乎無法讓它工作該聲明有什麼問題。SQL Server更新聲明

Update pc.PatientCopayId, pc.amount, pc.patientid, pc.apptid ,p.PaymentId,p.PaymentDate,p.PayorType,p.PaymentMethod, 
     p.RefNumber,p.PaymentAmount,p.PayorId,pt.LastFirstName As PatientName, 
     ISNULL((SELECT note FROM dbo.PatientNote WHERE NoteTypeId = 28 AND KeyValue = pc.PatientCopayId),'') AS Note 
from [dbo].[PatientCopay] pc, dbo.pymt_Payment p, dbo.Patient pt 
where ApptId = @ApptId 
    and p.PaymentId = pc.Paymentid 
    And pt.PatientId = p.PayorId 

價值和意義

pc.amount, = @PaymentAmount 
pc.patientid, = @PatientId 
pc.apptid , = @ApptId 
p.PaymentId, = @PaymentId 
p.PaymentDate, = @PaymentDate 
p.PayorType, = @PayorType 
p.PaymentMethod, = @PaymentMethod 
p.RefNumber, = @RefNumber 
p.PaymentAmount, = @PaymentAmount 
p.PayorId, = @PayorId 

回答

7

UPDATE聲明shoudl有以下形式

UPDATE TableName SET....

您的更新語句沒有表名或SET關鍵字。

更多信息HERE