Solved

adding 'not null' mysql column

Posted on 2003-11-26
3
436 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
  • 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now