Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

adding 'not null' mysql column

Posted on 2003-11-26
3
Medium Priority
?
461 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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 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