SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 field to show inserting and updating of records
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

abyie
Starting Member

42 Posts

Posted - 09/01/2006 :  10:24:42  Show Profile
Hi,
I neeed to add a column on a few table which would show me
the date and time a new record was inserted or a record was updated on the table.I created a column called LastModified with a datatype timestamp but it showing me binary values.Can I know why and if there is another of doing it then please let me know?

Thanks

----------
Abyie

casati74
Posting Yak Master

Italy
109 Posts

Posted - 09/01/2006 :  10:45:29  Show Profile
Hi,
i don't know very well sql but when i create a date column i use the datadate type and getdate() function to insert a date.

I hope is what you want
Go to Top of Page

harsh_athalye
Flowing Fount of Yak Knowledge

India
5509 Posts

Posted - 09/01/2006 :  10:51:25  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message
Timestamp is not useful for audit log, it is just use to version-stamp rows.
Better add a datetieme column along with GetDate() as default attached to it and add an Update trigger which will update this datetime column (LastModified) with current date.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

abyie
Starting Member

42 Posts

Posted - 09/01/2006 :  13:13:15  Show Profile
Thanks Harsh,
It worked perfectly for me...Really u guys r gr8.keep up
the good work.

Cheers
---------
Abyie
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22754 Posts

Posted - 09/02/2006 :  10:18:59  Show Profile  Send madhivanan a Yahoo! Message
Note that timestamp has nothing to do with date. The column gets updated whenever record is inserted or updated

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000