In my client's timesheet system (Intranet-hosted ASP.NET application)
there are three tables (see below for DDL).
In normal use a client can enter data into the tblTimesheetInputDetail
directly for an Employee, identified by the Employee's PinNo.
However, they want to be able to enter timesheet information for
multiple employees. The list of these employees is in the
tblBatchTimesheetPinNos. I don't want to use a cursor to do this, but
can't work out how to do it set-wise.
Procedurally, this is what is required.
For each @[EMAIL PROTECTED]
in tblBatchTimesheetPinNos
INSERT INTO tblTimesheetInputDetail
(fldPinNo,
fldPayrollYear,
fldPayrollWeek,
fldPayrollDate,
fldEntryType)
SELECT
@[EMAIL PROTECTED]
FROM
tblBatchTimesheetInputDetail
Next @[EMAIL PROTECTED]
thoughts on a better method?
Thanks
Edward
CREATE TABLE [dbo].[tblTimesheetInputDetail] (
[fldID] [int] IDENTITY (1, 1) NOT NULL ,
[fldPinNo] [int] NULL ,
[fldPayrollYear] [smallint] NULL ,
[fldPayrollWeek] [smallint] NULL ,
[fldPayrollDate] [datetime] NULL ,
[fldEntryType] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tblBatchTimesheetInputDetail] (
[fldID] [int] IDENTITY (1, 1) NOT NULL ,
[fldPayrollYear] [smallint] NULL ,
[fldPayrollWeek] [smallint] NULL ,
[fldPayrollDate] [datetime] NULL ,
[fldEntryType] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tblBatchTimesheetPinNos] (
[fldPinNo] [int] NOT NULL
) ON [PRIMARY]
GO


|