User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 373,934 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,148 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 1740 | 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)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 6:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC