I tried to create multiple tables in SQL but 2 of them gave the same error:
"Msg 1767, Level 16, State 0, Line 72 Foreign key 'FK__movimento__codem__3118447E' references invalid table "loan".
E
"Msg 1750, Level 16, State 0, Line 72.Could not create constraint or index. See previous errors."
These are the two tables:
create table emprestimo(
codemprestimo smallint,
dataemprestimo varchar(10),
valoremprestimo float,
taxajuro float,
numeroemprestimo smallint,
observacoes varchar(100),
codagencia smallint,
foreign key(codagencia) references agencia(codagencia)
on update cascade
on delete cascade,
codconta smallint,
foreign key(codconta) references conta(codconta)
on update cascade
on delete cascade,
primary key(codemprestimo));
create table movimentoconta(
codmovconta smallint,
datamov varchar(10),
valormov float,
codtipomov smallint,
foreign key(codtipomov) references tipomovimento(codtipomov)
on update cascade
on delete cascade,
codemprestimo smallint,
foreign key (codemprestimo) references emprestimo(codemprestimo)
on update cascade
on delete cascade,
codclienteconta smallint,
foreign key(codclienteconta) references clienteconta(codclienteconta)
on update cascade
on delete cascade,
primary key(codmovconta));