Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Insert Sysdate

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-02-20 : 00:22:25
How can I insert sysdate directly into table while inserting other values

Malathi Rao

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2007-02-20 : 00:44:06
set default on the column as getdate()
or
insert into table (Datecolumn)
values (getdate())
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-20 : 00:45:39
INSERT TargetTable (...)
SELECT GETDATE(), ...
[FROM SourceTable]


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

yonabout
Posting Yak Master

112 Posts

Posted - 2007-02-20 : 08:21:16
What's the difference between Getdate() and Current_timestamp()?

Cheers,

Yonabout
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-20 : 08:25:44
none.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-20 : 08:26:04
According to BOL, same.
quote:
CURRENT_TIMESTAMP
Returns the current date and time. This function is equivalent to GETDATE().




KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-20 : 08:30:08
And in SQL 2005 SP2 BoL,
"This function is the ANSI SQL equivalent to GETDATE"


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-20 : 08:32:35
Found this in BOL SP2 RTM,

quote:
Security Note:
Before you call EXECUTE with a character string, validate the character string. Never execute a command constructed from user input that has not been validated. For more information, see SQL Injection.



Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -