469,951 Members | 2,754 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

sql alter help

mysql> describe keywords;
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| page_id | int(10) unsigned | | PRI | NULL | auto_increment |
| keyword_txt | text | YES | | NULL | |
+-------------+------------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)
How do I alter these fields w/SQL so that they can not be null?

Thanks
Jul 20 '05 #1
2 1395
"leegold2" wrote:
mysql> describe keywords;
+-------------+------------------+------+-----+---------+-------------
---+ | Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+-------------
---+ | page_id | int(10) unsigned | | PRI | NULL |
auto_increment |
| keyword_txt | text | YES | | NULL | |
+-------------+------------------+------+-----+---------+-------------
---+ 2 rows in set (0.01 sec)
How do I alter these fields w/SQL so that they can not be null?

Thanks


I am sure someone else will give you the exact solution....

But for me, being lazy, I fire up phpmyadmin, and simply use the GUI
to change the field default to not null, and then phpmyadmin shows me
the exact sql that it executed.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/mySQL-sql-al...ict146886.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=492952
Jul 20 '05 #2
leegold2 wrote:
mysql> describe keywords;
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| page_id | int(10) unsigned | | PRI | NULL | auto_increment |
| keyword_txt | text | YES | | NULL | |
+-------------+------------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)

How do I alter these fields w/SQL so that they can not be null?


ALTER TABLE keywords CHANGE page_id page_id INT(10) NOT NULL;
ALTER TABLE keywords CHANGE keyword_txt keyword_txt TEXT NOT NULL;

Bart
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by me | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.