Jump to content

Recommended Posts

Posted

Boas,

estou a tentar fazer um trigger utilizando o After Insert, em que o objectivo é o seguinte:

Tabelas:

Tabela1

ID_1        int not null,

ValorA      int not null,

Tabela2

ID_2        int        not null,

ID_1        int        not null,

Campo1  int          not null.

um dos registos da tabela1 é:

ID_1        ValorA         

-------------------

1            10109         

na tabela2 vai ser introduzo valores mas o ID vem sempre com o valor 0:

ID_2        ID_1        Campo1

----------------------------

0              1            555

Preciso de criar um trigger que depois de ser inserido um registo qualquer na tabela2 o id seja alterado de 0 para o valor

10109555, ou seja, atraves da relação vams buscar o ValorA da tabela1 e concatenamos com o Campo1 da tabela2....

Alguem pode dar uma ajuda???

Obrigado!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.