Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This gives an error 1

Status
Not open for further replies.

compu66

Programmer
Dec 19, 2007
71
US
Hi,

I am adding a constraint while modifying the dbtype.

ALTER TABLE Exams Alter Column WLUs float null
CONSTRAINT DF_Exams_WLUs DEFAULT (0) for WLUs

This gives an error saying "incorrect syntax near constraint"

So i wrote it as
ALTER TABLE Exams Alter Column WLUs float null
ALTER TABLE Exams add CONSTRAINT DF_Exams_WLUs DEFAULT (0) for WLUs

Then it worked but I want in the first pattern,I dont want to write "alter table exam" twice just to add constraint

Thanks for the help in advance
 
Sometimes you don't get what you want. [wink]

Seriously, there's no other way to do it.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
You do know that floats are inexact datatypes and shouldn't be used if you plan to do any math with the numbers or you will getting rounding errors.

"NOTHING is more important in a database than integrity." ESquared
 
Floats are for boats!

< M!ke >
[small]Don't believe everything you think.[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top