Solved

adding 'not null' mysql column

Posted on 2003-11-26
3
456 Views
Last Modified: 2008-03-06

How do I change this:

mysql_query("ALTER TABLE samples ADD Nov_03 TEXT");

so that the column it sets up is not null?

Thanks,

Chris
0
Comment
Question by:ChrisAndrews
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
yahelb earned 50 total points
ID: 9828498
ALTER TABLE samples CHANGE Nov_03 Nov_03 TEXT NOT NULL
0
 

Author Comment

by:ChrisAndrews
ID: 9828885

Thank you, that works :)

So does it always have to be set up (ADD) and then changed (CHANGE) to make it not null?  It's not something that you can indicate in the ADD statment?

Chris
0
 
LVL 1

Expert Comment

by:yahelb
ID: 9830124
no you can do that with add
ALTER TABLE sample ADD Nov_03 TEXT NOT NULL.

but since the field Nov_03 already exist you just needed to change it.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question