RSS Forums RSS
Please support our MS SQL advertiser: Programming Forums
Views: 2170 | Replies: 1
Reply
Join Date: Mar 2007
Posts: 34
Reputation: shy_wani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
shy_wani shy_wani is offline Offline
Light Poster

how to capture date in MSSQL

  #1  
Apr 28th, 2007
hi..
i'm having a table called "Survey". Whenever user create survey, it will store the date and time the survey was created.

CREATE TABLE [dbo].[Survey] (
    [CustomerID] [int] NOT NULL ,
    [SurveyID] [int] IDENTITY (1, 1) NOT NULL ,
    [SurveyTitle] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    [SurveyDescription] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    [DateCreated] AS (getdate()) ,
    [coverletter] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]

right now..all the survey created by user are the the same for each record..
i guess i shouldn't use getdate()
what should i do to resolve this?
please help...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2007
Location: London
Posts: 114
Reputation: davidcairns is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
davidcairns davidcairns is offline Offline
Junior Poster

Re: how to capture date in MSSQL

  #2  
Apr 28th, 2007
It should use a type of datetime and a default of getdate(). I think the syntax was this

[DateCreated] [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 12:28 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