webForumDet fria alternativet

Ändra från not null till null

3 svar · 185 visningar · startad av Rocket

RocketMedlem sedan feb. 2000372 inlägg
#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.

spangoMedlem 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.

RocketMedlem 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"?

spangoMedlem 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.

134 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)