August 10, 2004 at 1:57 pm
I need a this to only insert if the problem_category = 'New User' and change the sub_type to 'Exchange'
CREATE TRIGGER [HelpdeskNewUser] ON dbo.Helpdesk
AFTER INSERT
When (Problem_Category = 'New User')
AS
INSERT Helpdesk (Priority, NAMEL, NAMEF, NetName, PCSerial,
Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS,
PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description,
Problem_Category, CapersTktNum, Problem_Tech_Update,
Problem_Update_Date, Closed, Date_Closed, Closed_By,
Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By,
HDUser, Sub_Category)
SELECT Priority, NAMEL, NAMEF, NetName, PCSerial, Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS, PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description, Problem_Category, CapersTktNum, Problem_Tech_Update, Problem_Update_Date, Closed, Date_Closed, Closed_By, Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By, HDUser, Sub_Category
FROM Inserted i
August 10, 2004 at 2:27 pm
I don't understand very well what you are trying to accomplish but this is shot in the dark
CREATE TRIGGER [HelpdeskNewUser] ON dbo.Helpdesk
AFTER INSERT
AS
if @@ROWCOUNT = 0
return
set nocount on
INSERT Helpdesk (Priority, NAMEL, NAMEF, NetName, PCSerial,
Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS,
PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description,
Problem_Category, CapersTktNum, Problem_Tech_Update,
Problem_Update_Date, Closed, Date_Closed, Closed_By,
Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By,
HDUser, Sub_Category)
SELECT Priority, NAMEL, NAMEF, NetName, PCSerial, Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS, PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description, Problem_Category, CapersTktNum, Problem_Tech_Update, Problem_Update_Date, Closed, Date_Closed, Closed_By, Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By, HDUser, Sub_category
FROM Inserted i where Problem_Category = 'New User'
don't know where "sub_type" goes either
* Noel
August 11, 2004 at 7:29 am
That was it thank you so much!!! the finished trigger is below:
CREATE TRIGGER [HelpdeskNewUser] ON dbo.Helpdesk
AFTER INSERT
AS
if @@ROWCOUNT = 0
return
set nocount on
INSERT Helpdesk (Priority, NAMEL, NAMEF, NetName, PCSerial,
Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS,
PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description,
Problem_Category, CapersTktNum, Problem_Tech_Update,
Problem_Update_Date, Closed, Date_Closed, Closed_By,
Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By,
HDUser, Sub_Category)
SELECT Priority, NAMEL, NAMEF, NetName, PCSerial, Room, WD, Ring, NetworkPrinter_1, ZUSER, PIN, MMS, AMS, PH_NO, PH_EXT, Date_Recieved, Due_Date, Problem_Description, Problem_Category, CapersTktNum, Problem_Tech_Update, Problem_Update_Date, Closed, Date_Closed, Closed_By, Res_Code, Office, SPA, EmailFLG, Tech_Queue, Assigned_By, HDUser, 'Exchange'
FROM Inserted i where Problem_Category = 'New User' and Sub_Category = 'AS400 / NDDS / Domain'
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply