Alex
Alex

Reputation: 3413

MySQL SQL script not working

I'm a newbye in MySQL (comming from SQLServer) and I have an syntax error with the following code (which I could use in SQLServer) and, looking in the manual, I haven't discovered the problem yet:

UPDATE t002_produto as p
   SET (p.prd_cod=111,
        p.prd_prod=1,
        p.prd_modal=222,
        p.prd_nome='Produto Teste 1',
        p.prd_abrev='Prod',
        p.prd_tipo='Prod',
        p.prd_bndes=1);

prd_cod = BIGINT(20) PK NN
prd_cod = BIGINT(20) NN
prd_modal = BIGINT(20)
prd_nome = VARCHAR(50)
prd_abrev = VARCHAR(10)
prd_tipo = VARCHAR(15)
prd_bndes = BIT(1)

Upvotes: 0

Views: 222

Answers (1)

vulkanino
vulkanino

Reputation: 9124

maybe the parenthesis are not needed. or maybe the AS is not allowed. easy to check. I would do:

UPDATE 
    t002_produto
SET
   prd_cod=111,
   prd_prod=1, 
   prd_modal=222, 
   prd_nome='Produto Teste 1',
   prd_abrev='Prod',
   prd_tipo='Prod',
   prd_bndes=1
;

BEWARE that it will update all the table since you didn't write a WHERE clause.

Upvotes: 2

Related Questions