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)
 checking duplicates

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-09-16 : 18:06:04
how can i check whether there is a duplicate in a table in stored proc..If i want to check whether there is any other emp_id in the emp_detail table if not present then insert otherwise update it.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-16 : 19:13:34
This will tell you if there are any dupe's
SELECT @RecCount = Count(emp_ID) FROM emp_detail WHERE emp_id = @yourEmpID
Then check the @RecCount parameter. If it's zero, you can add. If not, update
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-09-16 : 22:38:31
Thanks a lot ..got it....
Go to Top of Page
   

- Advertisement -