declare @name varchar(50),@lastname varchar(50),@mobile varchar(100),@email varchar(50)
Declare customer Cursor For
select name,lastname,mobile,email from customer
Open customer
Fetch Next From customer into @name,@lastname,@mobile,@email
While @@Fetch_Status = 0
Begin
BEGIN
insert into table1(id,name,lastname) select (select isnull(max(id),0)+1 from table1),@name,@lastname
insert into table2(id,mobile,emaul) select (select isnull(max(id),0)+1 from table2),@mobile,@email
END
Fetch Next From customer into @name,@lastname,@mobile,@email
End
Close customer
Deallocate customer