constraints. It makes life a lot easier.
"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:%23pfbU7n1EHA.1408@TK2MSFTNGP10.phx.gbl...
> That's what happens when you don't name your constraints. Run
> sp_helpconstraint to get the name of your constraint:
>
> sp_helpconstraint Events
>
> Pick out the relevant default and drop it:
>
> alter table events drop constraint DF__Events__EventEnd__61130711
> go
>
> Next, add in the correct default:
>
> alter table Events add constraint DF1_Events default (DATEADD(day, 5,
> GETDATE())) for EventEndDate
> go
>
>
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
>
www.pinnaclepublishing.com > .
> "Kaimuri" <kaimuri@somewhere.com> wrote in message
> news:eFN2Ptk1EHA.2112@TK2MSFTNGP15.phx.gbl...
> I have created a table called events with default Start and End Dates. I
> would like to modify the EndDate. Here's the table created.
>
> CREATE TABLE Events
>
> (
>
> EventID int IDENTITY(1,1) NOT NULL,
>
> EventType nvarchar(10) NOT NULL Default 'Party', EventTitle nvarchar(100)
> NULL, EventDescription ntext NULL, EventLanguage nvarchar (2) NULL,
> EventDate smalldatetime NULL DEFAULT GETDATE(), EventEndDate smalldatetime
> NULL DEFAULT DATEADD(day, 1, GETDATE()), EventCreator nvarchar (50) NOT
> NULL
> DEFAULT SYSTEM_USER)
>
> I would like to alter the EventEndDate column to
>
> EventEndDate smalldatetime NULL DEFAULT DATEADD(day, 5, GETDATE())
>
> I have tried
>
> Alter Table Events
>
> Alter column EventEndDate smalldatetime NOT NULL DEFAULT DATEADD(day, 5,
>
> GETDATE())
>
> I get the error : Server: Msg 156, Level 15, State 1, Line 2 Incorrect
> syntax near the keyword 'DEFAULT'.
>
> Please advise,
>
> Kaimuri
>
>