SQL Configuration

Hello Experts

    Can SQL Server 2005  be configured to populate a Time_Stamp field with the current date / time when the record is created?  How would you go about doing this?

Thank you for your time

algotubeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee SavidgeCommented:
0
Éric MoreauSenior .Net ConsultantCommented:
You can't. A timestamp field is a number field!
0
Éric MoreauSenior .Net ConsultantCommented:
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Lee SavidgeCommented:
That depends on your table. I have a database that has a time stamp field in all the tables that is a datetime field.

Lee
0
Éric MoreauSenior .Net ConsultantCommented:
>>That depends on your table. I have a database that has a time stamp field in all the tables that is a datetime field.

in Microsoft SQL Server with a field declared with a TimeStamp datatype?
0
Lee SavidgeCommented:
Nope, it is a field called timestamp declared with a datetime data type.
0
algotubeAuthor Commented:
Thanks everyone for your reply here is the structure of my table:


USE [ShearLine]
GO
/****** Object:  Table [dbo].[Master_Plate]    Script Date: 04/07/2011 10:15:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Master_Plate](
      [Plate_No] [char](12) NOT NULL,
      [Section_ID] [char](1) NOT NULL,
      [Cust_Name] [char](14) NULL,
      [Ord_Wid_Imp] [real] NULL,
      [Ord_Wid_Met] [real] NULL,
      [Ord_Gauge_Imp] [real] NULL,
      [Ord_Gauge_Met] [real] NULL,
      [Gauge_Tol_Pos_Imp] [real] NULL,
      [Gauge_Tol_Pos_Met] [real] NULL,
      [Gauge_Tol_Neg_Imp] [real] NULL,
      [Gauge_Tol_Neg_Met] [real] NULL,
      [Next_Process_Code] [char](3) NULL,
      [Prev_Process_Code] [char](3) NULL,
      [Width_Tol_Pos_Imp] [real] NULL,
      [Width_Tol_Pos_Met] [real] NULL,
      [Width_Tol_Neg_Imp] [real] NULL,
      [Width_Tol_Neg_Met] [real] NULL,
      [Rot_Horiz_Gap] [real] NULL,
      [Rot_Vert_Gap] [real] NULL,
      [Slit_Horiz_Gap] [real] NULL,
      [Slit_Vert_Gap] [real] NULL,
      [Test_Code] [char](2) NULL,
      [Special_Cut_Instr] [char](40) NULL,
      [Ruck_No] [int] NULL,
      [Plate_Status] [char](10) NULL,
      [Time_Stamp] [datetime] NULL,
 CONSTRAINT [PK_Master_Plate] PRIMARY KEY CLUSTERED
(
      [Plate_No] ASC,
      [Section_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
0
Lee SavidgeCommented:

USE [ShearLine]
GO
/****** Object:  Table [dbo].[Master_Plate]    Script Date: 04/07/2011 10:15:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Master_Plate](
      [Plate_No] [char](12) NOT NULL,
      [Section_ID] [char](1) NOT NULL,
      [Cust_Name] [char](14) NULL,
      [Ord_Wid_Imp] [real] NULL,
      [Ord_Wid_Met] [real] NULL,
      [Ord_Gauge_Imp] [real] NULL,
      [Ord_Gauge_Met] [real] NULL,
      [Gauge_Tol_Pos_Imp] [real] NULL,
      [Gauge_Tol_Pos_Met] [real] NULL,
      [Gauge_Tol_Neg_Imp] [real] NULL,
      [Gauge_Tol_Neg_Met] [real] NULL,
      [Next_Process_Code] [char](3) NULL,
      [Prev_Process_Code] [char](3) NULL,
      [Width_Tol_Pos_Imp] [real] NULL,
      [Width_Tol_Pos_Met] [real] NULL,
      [Width_Tol_Neg_Imp] [real] NULL,
      [Width_Tol_Neg_Met] [real] NULL,
      [Rot_Horiz_Gap] [real] NULL,
      [Rot_Vert_Gap] [real] NULL,
      [Slit_Horiz_Gap] [real] NULL,
      [Slit_Vert_Gap] [real] NULL,
      [Test_Code] [char](2) NULL,
      [Special_Cut_Instr] [char](40) NULL,
      [Ruck_No] [int] NULL,
      [Plate_Status] [char](10) NULL,
      [Time_Stamp] [datetime] default getdate()
 CONSTRAINT [PK_Master_Plate] PRIMARY KEY CLUSTERED
(
      [Plate_No] ASC,
      [Section_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee SavidgeCommented:
See above code.

Lee
0
Éric MoreauSenior .Net ConsultantCommented:
since the beginning I was thinking that you were using a field of a TimeStamp datatype!
0
algotubeAuthor Commented:
Thank you
0
Lee SavidgeCommented:
You're welcome.

Lee
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.