Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Trigger question?

Author  Topic 

eastcoaster
Starting Member

17 Posts

Posted - 2006-08-05 : 16:18:18
I want to write a trigger on a table in an SQL Server 2000.
How would I be able to distinuish between whether users are adding a new record or are changing a previous record? For instance, I want to generate a custom id first time a name is added to my namestable, but do not want to regenerate it when name is modified in the table.
Thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-05 : 16:25:43
You can create different triggers for insert and update.
Also for an insert the deleted table will be empty.

see
http://www.nigelrivett.net/SQLTriggers/Triggers_1_A_beginners_guide.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-07 : 08:41:14
Also read about Triggers in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -