Inserting current system date and time into column
I want to write a stored procedure which can insert current date and time(from system) into table column
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Anuja PawarRank #1,404 · 1.2K reputationPosted Dec 1, 2011, 9:52 PM EST
INSERT INTO TABLE (COL1) VALUES SELECT getdate()
If you need date in one column and time in another, then use
INSERT INTO TABLE (COL1,COL2) VALUES(
SELECT convert(varchar(20),getdate(),105),
SELECT convert(varchar(20),getdate(),108))
105 for date :02-12-2011
108 for time:13:21:43
Hope it helps :)