This is the update
The error
[red]
Msg 4145, Level 15, State 1, Line 11
An expression of non-boolean type specified in a context where a condition is expected, near ')'.
[/red]
What I am trying to do is add the EmployeeID_PK to the Tracking Table as a FK and need to update the existing records in the TrackingTable with the Employee's PK.
Here are the table structures I am working with.
Tracking Table
Employee Table.
Employee Net Accts Table
As seen here there is a one-to-one cascading relation on the [EmployeeID_PK] field between the Employee tables.
Thanks
John Fuhrman
Code:
Update dbo.tblTrackingTable
Set EmployeeID_FK = tblEmployeeNetAccts.EmployeeID_PK
Where
(
SELECT tblEmployeeNetAccts.EmployeeID_PK
FROM tblEmployeeNetAccts
INNER JOIN tblTrackingTable
ON tblEmployeeNetAccts.EmployeeDomainID = tblTrackingTable.EmployeeID
WHERE (NOT (tblTrackingTable.EmployeeID IS NULL))
)
[red]
Msg 4145, Level 15, State 1, Line 11
An expression of non-boolean type specified in a context where a condition is expected, near ')'.
[/red]
What I am trying to do is add the EmployeeID_PK to the Tracking Table as a FK and need to update the existing records in the TrackingTable with the Employee's PK.
Here are the table structures I am working with.
Tracking Table
Code:
CREATE TABLE [dbo].[tblTrackingTable](
[TrackingID_PK] [uniqueidentifier] NOT NULL CONSTRAINT [DF_tblTrackingTable_TrackingID_PK] DEFAULT (newid()),
[EmployeeID] [varchar](50) NULL,
[MachineName] [varchar](20) NULL,
[BoxNumber] [varchar](45) NOT NULL,
[FileNumber] [varchar](25) NOT NULL,
[TrackingDate] [datetime] NULL,
[Reship] [bit] NULL,
[BoxNumberOriginal] [varchar](50) NULL,
[EmployeeID_FK] [uniqueidentifier] NULL,
CONSTRAINT [TrackingID_PK] PRIMARY KEY NONCLUSTERED
Employee Table.
Code:
CREATE TABLE [dbo].[tblEmployee](
[EmployeeID_PK] [uniqueidentifier] NOT NULL CONSTRAINT [DF_tblEmployee_EmployeeID_PK_1] DEFAULT (newid()),
[EmployeeFN] [nvarchar](50) NULL,
[EmployeeMI] [nvarchar](50) NULL,
[EmployeeLN] [nvarchar](50) NULL,
[EmployeeDept] [nvarchar](50) NULL,
CONSTRAINT [PK_tblEmployee] PRIMARY KEY CLUSTERED
Employee Net Accts Table
Code:
CREATE TABLE [dbo].[tblEmployeeNetAccts](
[EmployeeID_PK] [uniqueidentifier] NOT NULL,
[EmployeeDomainID] [varchar](50) NULL,
[EmployeeFIPSID] [varchar](50) NULL,
CONSTRAINT [PK_tblEmployeeNetAccts_1] PRIMARY KEY CLUSTERED
(
[EmployeeID_PK] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [EmployeeDomainID] UNIQUE NONCLUSTERED
(
[EmployeeDomainID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[tblEmployeeNetAccts] WITH CHECK ADD CONSTRAINT [FK_tblEmployeeNetAccts_tblEmployee] FOREIGN KEY([EmployeeID_PK])
REFERENCES [dbo].[tblEmployee] ([EmployeeID_PK])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[tblEmployeeNetAccts] CHECK CONSTRAINT [FK_tblEmployeeNetAccts_tblEmployee]
As seen here there is a one-to-one cascading relation on the [EmployeeID_PK] field between the Employee tables.
Thanks
John Fuhrman