RSS Forums RSS
Please support our MS SQL advertiser: Programming Forums
Views: 29920 | Replies: 5
Reply
Join Date: Jul 2005
Posts: 2
Reputation: dieterm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dieterm dieterm is offline Offline
Newbie Poster

Default current datetime for column

  #1  
Jul 26th, 2005
Hi,

How do I design a table column named UpdateDate that will give the default date and time upon inserting a record into the table

I'm using Enterprise Manager in MSSQL

Many Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 5
Reputation: weilander is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
weilander weilander is offline Offline
Newbie Poster

Re: Default current datetime for column

  #2  
Aug 4th, 2005
In the column definition: default value = now()
Reply With Quote  
Join Date: Jul 2005
Posts: 2
Reputation: dieterm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dieterm dieterm is offline Offline
Newbie Poster

Re: Default current datetime for column

  #3  
Aug 5th, 2005
Thanks will try it
Reply With Quote  
Join Date: Dec 2006
Posts: 1
Reputation: wieland is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
wieland wieland is offline Offline
Newbie Poster

Solution Re: Default current datetime for column

  #4  
Dec 26th, 2006
Originally Posted by weilander View Post
In the column definition: default value = now()


Err: user must input default value to = ( getdate() )

With this SQL will insert the date + time everytime someone inserts values in that columns.
Last edited by wieland : Dec 26th, 2006 at 4:10 pm. Reason: solution
Reply With Quote  
Join Date: May 2006
Posts: 1
Reputation: WileECoyote is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
WileECoyote WileECoyote is offline Offline
Newbie Poster

Re: Default current datetime for column

  #5  
May 30th, 2006
Originally Posted by dieterm
Hi,

How do I design a table column named UpdateDate that will give the default date and time upon inserting a record into the table

I'm using Enterprise Manager in MSSQL

Many Thanks

It doesn't work for me. I have an error message when trying to use now().
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Default current datetime for column

  #6  
May 31st, 2006
create table tblname (
fieldname datetime default getdate()
)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:00 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC