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
 SQL Server Development (2000)
 Trigger ?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-28 : 08:22:40
Jason writes "Hi

I am currently trying to work out how to set a trigger on a db table that inserts a string value into a particular field after an INSERT.

If the field is "blank" then insert "none.gif".


Any help would be appreciated

Regards
Jay"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-28 : 08:55:53
create triggr xxxx on mytbl for insert
as
update mytbl
set fld = 'none'
from mytbl t
join inserted i
on t.pk = i.pk
where t.fld = ''

you might want coalesce(fld,'') = '' instead

==========================================
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
   

- Advertisement -