HI
Can Any one help
I have extra field on a table like
FDate, FYear, FMonth, FDay, FDatename
I have a triger that I will update this field every time transaction hapened, this field must be updated to the curent date, year, month, date name
I wrote something like.
CREATE TRIGGER tr_Test3
ON dbo.TTest3
FOR INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE TTest3
SET FCreatedBy = System_User
WHERE FID = (SELECT FID FROM inserted);
UPDATE TTest4
SET FCurentUser = System_User;
UPDATE TDates
SET Fdatetime = Current_Timesta mp;
SET FApplicationnam e = (SELECT App_Name());
SET Fdatetime = (SELECT GetDate());
SET FYear = (SELECT Year(GetDate()) );
SET FMonth = (SELECT Month(GetDate() ));
SET FDay = (SELECT Day(GetDate())) ;
SET FDatename = (SELECT Datename(Month, GetDate()));
END
I find the Error:
Incorrect syntax near '=' line 18
Incorrect syntax near '=' line 19
Incorrect syntax near '=' line 20
Incorrect syntax near '=' line 21
Incorrect syntax near '=' line 22
Incorrect syntax near '=' line 23
Can Any on help how can I update the table with this values.
Thanks
Can Any one help
I have extra field on a table like
FDate, FYear, FMonth, FDay, FDatename
I have a triger that I will update this field every time transaction hapened, this field must be updated to the curent date, year, month, date name
I wrote something like.
CREATE TRIGGER tr_Test3
ON dbo.TTest3
FOR INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE TTest3
SET FCreatedBy = System_User
WHERE FID = (SELECT FID FROM inserted);
UPDATE TTest4
SET FCurentUser = System_User;
UPDATE TDates
SET Fdatetime = Current_Timesta mp;
SET FApplicationnam e = (SELECT App_Name());
SET Fdatetime = (SELECT GetDate());
SET FYear = (SELECT Year(GetDate()) );
SET FMonth = (SELECT Month(GetDate() ));
SET FDay = (SELECT Day(GetDate())) ;
SET FDatename = (SELECT Datename(Month, GetDate()));
END
I find the Error:
Incorrect syntax near '=' line 18
Incorrect syntax near '=' line 19
Incorrect syntax near '=' line 20
Incorrect syntax near '=' line 21
Incorrect syntax near '=' line 22
Incorrect syntax near '=' line 23
Can Any on help how can I update the table with this values.
Thanks
Comment