Triggers that update a column name in the master table

I would appreciate any insight. I'm new with SQL and am trying to get a trigger to function. Here is what I'm trying to accomplish. I have a table called Asset_master that contains assets that are available, with a column_id of status=available. Once a users selects the available asset from the form, I have it writing a new record to another table called asset_provisioned. I'm trying to use a trigger to change the status=available to status=provisioned upon insert or update to the asset_provisoned table. My trigger works as enclosed however it replaces all the columns with provisioned and not the newly inserted row. Any help would be greatly appreciated.

I'm using SQL 2005 Developers

TRIGGER:

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

go

 

-- Creation date:

-- Author:

ALTER TRIGGER [dbo].[provisioned] ON [dbo].[asset_provisioned]

FOR INSERT

AS

UPDATE asset_master set status='provisioned'




Answer this question

Triggers that update a column name in the master table

  • jasonc65

    Please take a look at the CREATE TRIGGER topic in Books Online. You need to use the inserted/deleted virtual tables inside triggers to determine the rows that were affected by the INSERT/UPDATE/DELETE operation. You can then join these with the base tables or other tables to perform other operations.

  • Triggers that update a column name in the master table