webForumDet fria alternativet

Ändra från not null till null

Databaser & SQL

3 svar · 187 visningar · startad av Rocket

Medlem sedan feb. 2000372 inlägg
Frågan#1

Hur gör man för att ändra en colomn i en tabell från notnull till null, med mysql kommandon?
Jag har rätt så mycket info i databasen så jag vill itne göra om allt frånbörjan. Jag har ingen gui klient (eller vad det nu heter), så jag måste använda kommandon direkt i mysql prompten.

Medlem sedan juni 20008 205 inlägg
#2

Kolla http://www.mysql.com/doc/A/L/ALTER_TABLE.html

------------------
These are the cries of the carrots, the cries of the carrots! You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.

Medlem sedan feb. 2000372 inlägg
#3

Tackar, mycket bra.

Saken är den att jag nu har nollor (0) där det inte finns någon info i databasen. Men jag vill att det inte ska vara något där det inte finns någon info. Är det null eller not null som tillåter att det itne är någon info i en "ruta"?

Medlem sedan juni 20008 205 inlägg
#4

Vet inte om det går att stoppa in NULL på det viset... du kan ju prova UPDATE tabellen SET kolumnen = NULL WHERE kolumnen = 0, men jag tror att det kanske inte funkar.

------------------
These are the cries of the carrots, the cries of the carrots! You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.

394 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
122 ms — deklarationer (db)
129 ms — hämta statistik (db)
134 ms — hämta tråd, inlägg och bilagor (db)
128 ms — ändringar (db)