-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: SriSamp
Message 2 in Discussion

There are many ways by which you can solve this. I'm assuming that you are using SQL 
Server as your database, but the solution will apply to other databases as well.   (1) 
Use a stored procedure for your logic. You can then call this stored procedure from 
your application code. Inside this stored procedure you can first check whether the 
value exists and based on this take action. For example: CREATE PROCEDURE testProc 
(@tcValue VARCHAR(11)) AS BEGIN    IF NOT EXISTS (SELECT 1 FROM yourTable WHERE value 
= @tcValue)       INSERT INTO ...    ELSE       RAISERROR .... END   (2) You can use a 
trigger to implement this logic. Inside the trigger you can check for the existence of 
this value and based on it rollback the transaction.   The simplest method is to use 
the stored procedure, since you can later on extend the logic as you see fit.   HTH, 
Srinivas Sampath MVP - SQL Server http://www32.brinkster.com/srisamp  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to