Re: alter column but setting the default value
From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 08/12/04
- Next message: bojci: "Re: alter column but setting the default value"
- Previous message: alex: "Re: wrong scenario for partitioned views?"
- In reply to: Sam Martin: "alter column but setting the default value"
- Next in thread: Sam Martin: "Re: alter column but setting the default value"
- Reply: Sam Martin: "Re: alter column but setting the default value"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 12:48:13 +0100
Is this what you want?:
alter table dbo.mytable
add mydatecolumn datetime null,
constraint df_mytable__mydatecolumn default getdate() for mydatecolumn with
values
-- Jacco Schalkwijk SQL Server MVP "Sam Martin" <sambomartin@yahoo.co.uk> wrote in message news:%230tF9%23FgEHA.3676@TK2MSFTNGP12.phx.gbl... > hi all, > > to add a new column to a table that has a default value of "getdate()" > is ......... > > alter table dbo.mytable > add mydatecolumn datetime null > default getdate() > > however I want to alter table and set the default value for a column which > is not possible using the DDL commands in SQL? (right?) > > but enterprise manager does it, and i can't believe it copies a table, > reinserts the rows, etc. > is there a sp_? that does this? > > tia > > sam martin > >
- Next message: bojci: "Re: alter column but setting the default value"
- Previous message: alex: "Re: wrong scenario for partitioned views?"
- In reply to: Sam Martin: "alter column but setting the default value"
- Next in thread: Sam Martin: "Re: alter column but setting the default value"
- Reply: Sam Martin: "Re: alter column but setting the default value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|