You are here: Re: Change field to Not Null in MySQL « PHP Programming Language « IT news, forums, messages
Re: Change field to Not Null in MySQL

Posted by Jerry Stuckle on 11/02/49 11:32

Smitro wrote:
> Hi all,
>
> I'm in the middle of building a new server up and converting current web
> sites across. in this process I have moved to PHP 5 and MySQL 5. I have
> just run into a problem with MySQL.
>
> I'm using phpMyAdmin to do the editing of tables. I cannot set a feild
> to be Not Null. When I do, it runs the command without error but doesn't
> change anything. I've tried with auto increment and without. I'm just
> doing the simple way, editing the table then changeing the drop down
> box, and it will not change.
>
> I thought maybe there was something wrong with my table, so I created a
> test one, and the same thing happened. Any ideas? I'm scraching my head,
> I've done this in the past without a problem.
>
> Smitro

Smitro,

Do you in fact have nulls in the column on any row?

Null/Not Null is only a constraint on the column; changing it doesn't
actually change the contents of that column. If you want to change to
not null, you must first get rid of all null values in the column (i.e.
UPDATE statement), then change the constraint.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация