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.
Author |
Topic |
mabel
Starting Member
4 Posts |
Posted - 2011-08-05 : 20:10:24
|
Hi all,I need to retrieve current system time and insert it into an integer field.Could any one help do this please.Many thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
mabel
Starting Member
4 Posts |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-08-06 : 06:59:56
|
First question. Why?You're setting yourself up for a lot of pain in the future when querying that column, using the time anywhere.--Gail ShawSQL Server MVP |
 |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-08-06 : 07:29:48
|
[code]INSERT INTO yourTable (yourIntegerColum)SELECT DATEPART(second,CURRENT_TIMESTAMP) + 100 * DATEPART (minute,CURRENT_TIMESTAMP) + 10000 * DATEPART(hour, CURRENT_TIMESTAMP);[/code] |
 |
|
|
|
|