ahthomas
Ten Centuries
Points: 1382
More actions
January 30, 2013 at 8:21 am
#273680
I have to create a table where one column is populated using GETDATE(). How do I add that in to this code correctly?
create table mytable
(
UserLogIDInt IDENTITY(1,1) NOT NULL,
UserDomainnvarchar(50),
LoggedUsernamenvarchar(50),
AccessDatenvarchar(50)
)
Ant-Green
SSC Guru
Points: 113507
January 30, 2013 at 8:24 am
#1582622
Well first off store dates as dates not as strings,
So you would need to change AccessDate to DATETIME or add a column of the DATETIME data type.
They look at creating a default
CREATE TABLE DateColumnTable
DateColumn DATETIME DEFAULT GETDATE()
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply