[dba-SQLServer] ADD Constraint

David Lewis DavidL at sierranevada.com
Wed Mar 30 12:21:39 CST 2005


Not sure, but I think you need ADD CONSTRAINT

D. Lewis


Message: 1
Date: Tue, 29 Mar 2005 11:53:29 -0800
From: "Ken Stoker" <kens.programming at verizon.net>
Subject: [dba-SQLServer] Adding a default to an existing column
To: <dba-sqlserver at databaseadvisors.com>
Message-ID: <0IE400I33PSVKK00 at vms042.mailsrvcs.net>
Content-Type: text/plain;	charset="windows-1250"

I have put together the following to add a default to an existing table.
It is telling me there is a syntax error near CONSTRAINT.  I have tried
many different things, this being the latest, getting similar problems.


 

ALTER TABLE TableName

ALTER COLUMN ColumnName UserDefinedType NULL

CONSTRAINT AddOwnerDflt

DEFAULT '100000' WITH VALUES

GO

 

Thanks for any help.

 

Ken



More information about the dba-SQLServer mailing list