Alright, Instead of making a new thread for each little one I'm stuck with right now, I figure I'd make a later thread.
I am trying to insert data into a view using a trigger and I am sure my trigger is wrong. So before we start on the trigger itself, I'll show you my tables that are linked to the view.
CREATE TABLE TruckAssignments(
DriverID INT NOT NULL,
TruckID INT NOT NULL,
DateOut DATE NOT NULL,
DateIn DATE NULL,
CONSTRAINT PK_DriverID_TruckID PRIMARY KEY CLUSTERED (DriverID, TruckID ASC)
);
CREATE TABLE Trucks(
TruckID INT NOT NULL,
VIN VARCHAR(30) NOT NULL,
Year INT CHECK (Year BETWEEN 1000 AND 9999) NOT NULL,
Make VARCHAR(15) NOT NULL,
Model VARCHAR(25) NOT NULL,
Colour VARCHAR(10) NOT NULL,
LicPlate VARCHAR(8) NOT NULL,
CONSTRAINT PK_Trucks_TruckID PRIMARY KEY CLUSTERED (TruckID ASC)
);
CREATE TABLE Drivers(
DriverID INT NOT NULL,
FirstName VARCHAR(30) NOT NULL,
LastName VARCHAR(30) NOT NULL,
Licence CHAR(12) NOT NULL,
LicenceClass INT NOT NULL,
SSN CHAR(9) NOT NULL,
CONSTRAINT PK_Drivers_DriverID PRIMARY KEY CLUSTERED (DriverID ASC)
);.
And my View.
CREATE VIEW SignOutForm AS
SELECT t.LicPlate, d.FirstName, d.LastName, a.DateOut, a.DateIn
FROM Trucks AS t
JOIN TruckAssignments AS a
ON (t.TruckID = a.TruckID)
JOIN Drivers AS d
ON (a.DriverID = d.DriverID);
What I am trying to do is have it so that looking at the view, the manager can add a new row of data to the tables, and update whatever current info he can see on the view. Any ideas?