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)
 stored procedure to eliminate duplicate values

Author  Topic 

SATHISH_KUMAR
Starting Member

1 Post

Posted - 2003-07-08 : 07:24:42
I am new to the stored procedures
I am passing some values to the stored procedure which is used to insert values to the databse, at the time of insertion it should check if the value exists if yes only it should insert the values otherwise it should redirect to an error page.
How should i go about Can you help me in this stored procedure

What you think is waht you are

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-07-08 : 09:47:55
Use Triggers for this job.



Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2003-07-08 : 10:08:59
I think you'd be better to use an IF NOT EXISTS statement. Something like



IF NOT EXISTS (Select * from MyTable Where PKVal = @Parm)
INSERT ...
ELSE
RAISERROR ...



I think triggers would just add unnecessary complexity.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -