Home All Groups Group Topic Archive Search About
Author
6 Jan 2006 11:44 AM
gary
as current time..
how can i set that in mssql 2005 ?

Author
6 Jan 2006 11:55 AM
Ryan
Here's the example in 2005 Books Online. The date_ins GETDATE() is the one
you need.

CREATE TABLE test_defaults
   (keycol      smallint,
   process_id   smallint DEFAULT @@SPID,   --Preferred default definition
   date_ins   datetime DEFAULT getdate(),   --Preferred default definition
   mathcol      smallint DEFAULT 10 * 2,   --Preferred default definition
   char1      char(3),
   char2      char(3) DEFAULT 'xyz') --Preferred default definition;
GO


--
HTH. Ryan


Show quote
"gary" <ad***@newsgroup.com.hk> wrote in message
news:eHFDHarEGHA.3100@tk2msftngp13.phx.gbl...
> as current time..
> how can i set that in mssql 2005 ?
>
Author
6 Jan 2006 2:53 PM
Tibor Karaszi
Note that naming constraints is considered good practice. Sooner or later you will want to change
some defaults, and if you don't know the name, you have to look up the auto-generated name in the
system tables. This makes implementation of such scripts a mess.

Show quote
"Ryan" <Ryan_Waight@nospam.hotmail.com> wrote in message
news:uwM3JhrEGHA.916@TK2MSFTNGP10.phx.gbl...
> Here's the example in 2005 Books Online. The date_ins GETDATE() is the one you need.
>
> CREATE TABLE test_defaults
>   (keycol      smallint,
>   process_id   smallint DEFAULT @@SPID,   --Preferred default definition
>   date_ins   datetime DEFAULT getdate(),   --Preferred default definition
>   mathcol      smallint DEFAULT 10 * 2,   --Preferred default definition
>   char1      char(3),
>   char2      char(3) DEFAULT 'xyz') --Preferred default definition;
> GO
>
>
> --
> HTH. Ryan
>
>
> "gary" <ad***@newsgroup.com.hk> wrote in message news:eHFDHarEGHA.3100@tk2msftngp13.phx.gbl...
>> as current time..
>> how can i set that in mssql 2005 ?
>>
>
>

AddThis Social Bookmark Button