Answered
Problem recording a workstation ID
Hello All,
Ok not sure if this is the correct category to post this in but ill try.
I have a large bespoked program throughout our company allowing users to manage 'works orders' and other items via web pages with cold fussion etc (normal stuff)
Just lately there is a need to trace when certain things are deleted from our database, for auditing purposes.
I set up an SQL trigger on the table in question.. see below
----------------------------------------
CREATE TRIGGER [woDelete] ON dbo.worksorders
FOR DELETE
AS
INSERT INTO Audit_Wo (Actiontaken, auser, adate, wo)
SELECT 'D', USER_NAME (), GetDate(),Del.won from Deleted Del
----------------------------------------------
so every time a worksorder is deleted I get an audit record in the Audit_wo table showing me what date, worksorder, and user deleted it.
My problem is when a user deletes a worksordeer through our off the shelf MRP program the 'USER_NAME()' is populated correctly i.e I would see DOMAIN\username in the audit table.
However if a user deletes a worksorder via my bespoked coldfussion pages the 'USER_NAME()' variable returns just 'dbo' im assuming this is because its actually being deleted by the server so therefore the user deleting it is realy the server and not the user logged into a workstation.
How can I set a variable on my cold fussion page that would then be seen by the SQL trigger, Im just not sure on how it works can I just <cfset a variable up and then put that variable in my SQL trigger or how do I pass a coldfussion variable to an SQL one. im just confussed how I would do this.
I thought id ask here although im going to go and play now see if I can resolve it as well.
Many Kind Regards Guy
Ok not sure if this is the correct category to post this in but ill try.
I have a large bespoked program throughout our company allowing users to manage 'works orders' and other items via web pages with cold fussion etc (normal stuff)
Just lately there is a need to trace when certain things are deleted from our database, for auditing purposes.
I set up an SQL trigger on the table in question.. see below
----------------------------------------
CREATE TRIGGER [woDelete] ON dbo.worksorders
FOR DELETE
AS
INSERT INTO Audit_Wo (Actiontaken, auser, adate, wo)
SELECT 'D', USER_NAME (), GetDate(),Del.won from Deleted Del
----------------------------------------------
so every time a worksorder is deleted I get an audit record in the Audit_wo table showing me what date, worksorder, and user deleted it.
My problem is when a user deletes a worksordeer through our off the shelf MRP program the 'USER_NAME()' is populated correctly i.e I would see DOMAIN\username in the audit table.
However if a user deletes a worksorder via my bespoked coldfussion pages the 'USER_NAME()' variable returns just 'dbo' im assuming this is because its actually being deleted by the server so therefore the user deleting it is realy the server and not the user logged into a workstation.
How can I set a variable on my cold fussion page that would then be seen by the SQL trigger, Im just not sure on how it works can I just <cfset a variable up and then put that variable in my SQL trigger or how do I pass a coldfussion variable to an SQL one. im just confussed how I would do this.
I thought id ask here although im going to go and play now see if I can resolve it as well.
Many Kind Regards Guy