Hello,
Can you please assist with this PROC. I am getting the following error:
Msg 102, Level 15, State 1, Procedure spEmployeeDDA, Line 27
Incorrect syntax near 'EMPLOYEE'.
Here is the SQL --->
CREATE PROCEDURE [dbo].[spEmployeeDDA]
-- Add the parameters for the stored procedure here
AS
BEGIN
DECLARE @EmpDDA table (
employee varchar(10) NULL,
LName varchar(20) Null,
FName varchar (20) NULL,
Bank varchar(32) NULL,
AccountNumber decimal(12,5),
DepositAmount decimal(12,5),
CheckDate datetime,
EarnDed varchar(5),
HoursWorked decimal(12,5)
)
INSERT INTO @EmpDDA (employee, LName, FName, Bank, AccountNumber, DepositAmount, CheckDate, EarnDed, HoursWorked)
SELECT e.employee, e.lastname, e.firstname, t.BKACCTDESC, t.acctnum, t.DEPOSITAMT, h.transdate, d.EARNDED, D.HOURS
FROM SageHRMS_GTM..UPCHKD D
INNER Join SageHRMS_GTM..UPEMPL e
on d.EMPLOYEE = e.EMPLOYEE
INNER Join SageHRMS_GTM..UPETRN t
on d.EMPLOYEE = t.EMPLOYEE
INNER Join SageHRMS_GTM..UPCHKH h
on t.EMPLOYEE = h.EMPLOYEE