0

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)
0

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That's it... very simple... Why not the guys unify the syntax of SQL, at least in basic operations? Thanks...
the problem was the parenthesis, AS is Ok. I'd forgot the WHERE clause, which is present in my code.
they do. it's microsoft that ignores the standards. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.