4
I have two tables, one call coletor
, and another call material
, have a proc
calling for cadMat
, that was to register material in the bank and by Cpf (parameter of proc) put as the name of the collector the materials that he brought when Cpf exists in the bank (with an instruction update), but in doing so the instruction changes all lines, and not some as expected, someone can help me?
The code is here if it helps.
create proc cadMat /*Cadastra o material no banco de dados Ok!(sistema)*/
@cpfColetor char(12),
@nomeMaterial varchar(30),
@tipoMaterial varchar(8),
@zonaMaterial varchar(10),
@qtdeMaterial float,
@dataRecebimentoMaterial datetime
as
begin
insert into material values(@nomeMaterial,@tipoMaterial,@zonaMaterial,@qtdeMaterial,@dataRecebimentoMaterial,@cpfColetor,'')
update coletor
set qtdeMatCol +=@qtdeMaterial where cpfCol = @cpfColetor
update material set nomeColMat = nomeCol from coletor where cpfCol = @cpfColetor
end
Hi man, td well? , You can give me some article or link that explains well this concept of Join and such?.
– Gilvane Silva
Unfortunately, I don’t know any articles about that, but I do know that there are many. A search for "understanding Join sql" has shown me these articles that I think can help: http://www.devmedia.com.br/sql-join-understandhow to work: http://www.devmedia.com.br/sql-join-work/.
– Caffé