Jump to content
Sign in to follow this  
Daniel Alves

SQL Como adicionar coluna nova?!

Recommended Posts

Daniel Alves

Boas caros amigos do P@P

Mais uma vez estou com uma duvida enorme.

Quero adicionar uma nova coluna...

Usando o phpmyadmin dá o seguinte erro

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL FIRST' at line 1

A query é:

ALTER TABLE  `contratos` ADD  `sid` VARCHAR NOT NULL FIRST

Será por ter a propriedade Alter Table?!

Sou novato em programação web e sql. 

Alguem me pode ajudar?

Desde já muito obrigado

Cumprimentos

Daniel Alves

Share this post


Link to post
Share on other sites
Daniel Alves

Já resolvi pessoal...

Penso que o problema era por estar a querer inserir no inicio da tabela...

Experimentei inserir no fim e já deu  :cheesygrin:

Desculpem. Espero poder ajudar alguem assim

Share this post


Link to post
Share on other sites
HappyHippyHippo

o problema parece estar aqui :

ALTER TABLE  `contratos` ADD  `sid` VARCHAR NOT NULL FIRST

>>

ALTER TABLE  `contratos` ADD  `sid` VARCHAR(256) NOT NULL FIRST

falta o tamanho do varchar ...


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • 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.