473,320 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Add A Constraint To An Existing Table

create table student(roll int,name varchar(10))
insert into student values(1,'YOGESH')

ALTER TABLE student ADD CONSTRAINT cont_name
NOT NULL(name)
Incorrect syntax near the keyword 'NOT'.

I m not getting how to add constraint.
May 3 '08 #1
1 1300
ck9663
2,878 Expert 2GB
I think this you're going to define this as CHECK CONSTRAINT. Here's the full ALTER TABLE syntax.

-- CK
May 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Guinness Mann | last post by:
I have an existing table: CREATE TABLE TestQuestions ( qId int NOT NULL IDENTITY(1,1) CONSTRAINT PK_TestQuestions PRIMARY KEY NONCLUSTERED, testId int NOT NULL REFERENCES Tests(testId)...
0
by: Ron | last post by:
Mandatories: Ver 7.3.4, Redhat Linux 8.0, P4, 2GB RAM I want to add a 'nullable' foreign key to a column in a table. I have tables "company" and "project" which may be related by...
1
by: Guinness Mann | last post by:
I have an existing table: CREATE TABLE TestQuestions ( qId int NOT NULL IDENTITY(1,1) CONSTRAINT PK_TestQuestions PRIMARY KEY NONCLUSTERED, testId int NOT NULL REFERENCES Tests(testId)...
3
by: peteh | last post by:
Hello All; Assuming a PMR is in order for this, but wanted to run by the group to see if anyone had similar experience. We just upgraded a DB2 V8 AIX (DPF) environment to FP10 from FP6 and have a...
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
5
by: kutty | last post by:
Hi All, I am loading data to a child table from a text file. the text files also contains data not referenced by parent key. while loading the data if one row fails to satisfies the constraint...
1
by: Spectre1337 | last post by:
Hello, it seems like the check constraint validation of MS SQL Server Management Studio express is horribly, horribly broken. Either that or I'm using it wrong. I hope it's the latter. I'm...
5
by: ganeshshegde | last post by:
How to add not null constrint to an existing table? i tried with "alter table emp add constraint not_null_name not null(name)" command but it's giving error .......... alter table emp add...
25
by: Thomas R. Hummel | last post by:
I'm going to try to describe this situation as best as I can, but if anything is unclear please let me know. Some of this database was already in place before I arrived on the scene, and I don't...
15
by: Frank Swarbrick | last post by:
I have the following three tables DROP TABLE CALLTRAK.SERVICE_CODES @ CREATE TABLE CALLTRAK.SERVICE_CODES ( CODE CHAR(1) NOT NULL , CONSTRAINT SERVICE_CODES_PK PRIMARY KEY (CODE) ,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.