RE: Trigger help

RE: Trigger help

 

  

I agree. Make the app do that kind of work.

-----Original Message-----
From: Jaime E. Maccou
[mailto:mssqldba-ezmlmshield-x88153704.[Email address protected]
Sent: Wednesday, April 30, 2008 3:53 PM
To: LazyDBA Discussion
Subject: Re: Trigger help

Suggestion: A trigger may be heavy over time and depending on your
transaction activity, you may consider (if this for an application) to
validate the data on the front end before passing it to the database.
----- Original Message -----
From: "Marty Galvan" <mssqldba-ezmlmshield-x18667764.[Email address
protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Wednesday, April 30, 2008 3:13:16 PM (GMT-0500) America/New_York
Subject: Trigger help

Hi all,
I'm trying to write a trigger that will raise an error on a field if it is
null on insert.

Example:

I have an item that requires the country of origin. Upon insert, the user
does not put in the country of origin.

How would I write that trigger?

I have so far:

create trigger tI_timItem_COO on dbo.timItem For Insert As If
Insert(usefld1) is null Then Raiserror('Please enter in a country of origin,
10,1) Rollback Tran

End

I'm not sure if I'm even close.

Thanks,



Thank you,

Marty Galvan
Business Systems Manager - DBA
Making Memories
[Email address protected] <mailto:[Email address protected] 801-294-0430
x185




---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html

MS Sql Server LazyDBA home page