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)
 Delete trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-13 : 08:33:37
Deepa writes "I made two tables first(in which i have created code as the primary key),second(code as foreign key).
whenever I attempt to delete any record from the first table it give me an error.

I used the following code to avoid this.But it was of no use.

create trigger tr1 on first for delete 
as begin
declare @a int
select @a=deleted.code from deleted /*join first on deleted.code=first.code*/
delete from second where code=@a
print 'delete from second'
end


Please recommend any solution if you have.
Thanking You.

SQl server 2000"

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2004-09-13 : 10:07:34
USE INSTEAD OF TRIGGER

- Sekar
Go to Top of Page
   

- Advertisement -