我的sp执行没有错误,但附加记录不在表中

时间:2016-06-01 15:17:00

标签: sql-server

该表具有自动身份证号码。下面是我的sp。可能是什么问题?

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Append Samples Sent Nonwater Paragroups]
@Enter_FCOC_Number VARCHAR(20),
@Enter_SOW_MATRIX VARCHAR(20)
AS
INSERT INTO [Samples Sent]
     ([Client Sample ID],[LCOC Number],[SOWNumber],ParagroupID)
SELECT [Planned Samples].[Client Sample ID], [Planned Samples].[FCOC Number], [Project Task Stations].SOWNumber, [refProject/SOW/Title/Lab/Paragroup].ParagroupID
FROM (([Planned Samples] INNER JOIN [Project Task Stations] ON ([Planned Samples].SOWNumber = [Project Task Stations].SOWNumber) AND ([Planned Samples].Station = [Project Task Stations].Station) AND ([Planned Samples].Projectid = [Project Task Stations].ProjectID)) INNER JOIN [refProject/SOW/Title/Lab/Paragroup] ON ([Project Task Stations].SOWNumber = [refProject/SOW/Title/Lab/Paragroup].[SOW Number]) AND ([Project Task Stations].ProjectID = [refProject/SOW/Title/Lab/Paragroup].ProjectID)) LEFT JOIN [Samples Sent] ON [Planned Samples].[Client Sample ID] = [Samples Sent].[Client Sample ID]
GROUP BY [Planned Samples].[Client Sample ID], [Planned Samples].[FCOC Number], [Project Task Stations].SOWNumber, [refProject/SOW/Title/Lab/Paragroup].ParagroupID, [Planned Samples].MedType, [refProject/SOW/Title/Lab/Paragroup].Matrix, [Planned Samples].VolatilesOnly, [refProject/SOW/Title/Lab/Paragroup].ParameterGroup, [Planned Samples].SampleType, [Samples Sent].[Client Sample ID], [refProject/SOW/Title/Lab/Paragroup].Labcode
HAVING ((([Planned Samples].[FCOC Number])=@Enter_FCOC_Number) AND (([Planned Samples].MedType)<>'wq' And ([Planned Samples].MedType)<>'SQ') AND (([refProject/SOW/Title/Lab/Paragroup].Matrix) = @Enter_SOW_MATRIX AND ([refProject/SOW/Title/Lab/Paragroup].Matrix)<>'WATER' And ([refProject/SOW/Title/Lab/Paragroup].Matrix)<>'WIPE') AND (([Planned Samples].VolatilesOnly)='0') AND (([Samples Sent].[Client Sample ID]) Is Null)) OR ((([Planned Samples].MedType)<>'wq' And ([Planned Samples].MedType)<>'SQ') AND (([refProject/SOW/Title/Lab/Paragroup].Matrix)<>'water') AND (([Planned Samples].VolatilesOnly)='1') AND (([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%voa%' Or ([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%Ethan%' Or ([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%acro%' Or ([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%encore%' Or ([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%moisture%' Or ([refProject/SOW/Title/Lab/Paragroup].ParameterGroup) Like '%dry_wt%') AND (([Samples Sent].[Client Sample ID]) Is Null));

0 个答案:

没有答案