Avatar of TickTech
TickTech
 asked on

10 second "ALTER TABLE ALTER COLUMN" question

New to SQL2012, need help on simple sql question

 
///////////////////////////////////////////////////////////////////////////////////////////
--The following code runs and no error

alter table  TestTable2Delet
  ALTER COLUMN  FirstName varchar(25) Not Null



//////////////////////////////////////////////////////////////////////////////////////////////
--The following code don't run, ?????WHY????? Does it mean I have to have a "alter table" sentence for each alter column line??????????????

alter table  TestTable2Delet
  ALTER COLUMN  FirstName varchar(25) Not Null,  
  ALTER COLUMN  LastName  varchar(25) Not null


---?????WHY????? Does it mean I have to have a "alter table" sentence for each alter column line??????????????
Microsoft SQL Server 2008Microsoft SQL Server 2005

Avatar of undefined
Last Comment
Dan Craciun

8/22/2022 - Mon
Dan Craciun

Try this:

alter table  TestTable2Delet
  ALTER COLUMN  FirstName varchar(25) Not Null,   LastName  varchar(25) Not null
TickTech

ASKER
Hi Dan,

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ','.
ASKER CERTIFIED SOLUTION
Dan Craciun

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
TickTech

ASKER
thanks for the help.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Dan Craciun

You're welcome.
Glad I could help!