create table re(id numeric(1),bin varchar(10))
how to add not null on table as well as foreign key
create table re(id numeric(1),bin varchar(10))
how to add not null on table as well as foreign key
Just add "NOT NULL" to all the columns you want to prevent from being NULL:
create table re(id numeric(1) NOT NULL,
bin varchar(10) NOT NULL)
If you want to change it later on, you can do (syntax for SQL Server 2005 and up):
ALTER TABLE re
ALTER COLUMN id NUMERIC(1) NOT NULL
ALTER TABLE re
ALTER COLUMN bin VARCHAR(10) NOT NULL
What do you mean by "foreign key" ? On which column ? To which other table and column ?
Check out some of these basic SQL tutorials first - they should get you started:
Marc