Suppose i have a table called customer which is as follows
create table customer(
customerid int identity(1,1) primary key,
customername varchar(50),
emailid varchar(30) unique,
address varchar(max),
stateid int foreign key references state(stateid)
)
now i have a table called deletecustom which is like
create table deletecustom(
deletionid int identity(1,1) primary key,
customerid int
)
i need to delete the entry in the customer table for the value inserted in the deletecustom table
so i use a trigger like
create trigger deletecustomer on deletecustom
for insert
as
declare @cid int;
select @cid=customerid from inserted
delete from customer where customer.customerid=@customerid
This deletes the records from the customer table. Is there a way wherein i can re use the deleted customerid field for creation of one more record? What i mean is if i delete a customer whose customerid is 1, can i use customer id=1 for some other customer just for proper utilization?