I am coming from an access background. I need to join 2 tables but am having trouble with the append or insert statement.
I have 2 tables, tblContributions and tblEmployees. I have 1 parameter @ContributionMasterID. I need to append the @ContributionMasterID and all employeeID's to tblcontributions where termdate is not null and AccNo is not null.
Here is where I am at so far:
INSERT INTO [tblContributions] ([ContributionMasterID], [EmployeeID]) SELECT [EmployeeID] FROM tblContributions AS tblContributions_1 INNER JOIN tblEmployees ON tblContributions_1.EmployeeID = tblEmployees.EmployeeID WHERE (tblEmployees.SchwabAccNo IS NOT
NULL) AND (tblEmployees.DateofTerm IS NULL) VALUES (@ContributionMasterID)
In access it would be:
INSERT INTO tblContributions ( ContributionMasterID, EmployeeID )
SELECT [@ContributionMasterID] AS Expr1, dbo_tblEmployees.EmployeeID
FROM dbo_tblContributions INNER JOIN dbo_tblEmployees ON dbo_tblContributions.EmployeeID = dbo_tblEmployees.EmployeeID
WHERE (((dbo_tblEmployees.AccNo) Is Not Null) AND ((dbo_tblEmployees.DateofTerm) Is Null));
I will try it some more. Any assistance is appreciated.
View Complete Post