You are here: Re: Add a datestamp to an existing table « MsSQL Server « IT news, forums, messages
Re: Add a datestamp to an existing table

Posted by Hugo Kornelis on 12/04/07 21:00

On Tue, 4 Dec 2007 10:06:24 -0800 (PST), scoots987 wrote:

>Hi all,
>
>I have an existing table(Several actually) that I want to add a column
>or two or three. I need to have, I think, at least two columns. One
>for Created date and believe this is a no brainer in that I just add
>the column and set the default to getdate(). Two, for tracking a
>modified date of the row of data. I want to keep it simple. What do I
>do to track the modify date of a row in SQL Server 2005? Anytime any
>data changes on a row update the update column? Is a trigger the only
>way to accomplish this task?

Hi scoots987,

Yes, a trigger is the only way. There is no builtin standard out of the
box functionality for this.

>Another column could be used to track who changed it. Is there a neat
>way to determine username, machine name, MAC address or any other
>method? I pretty wide open on this one as I am not sure what I want to
>use here.

Check out SUSER_SNAME() and HOST_NAME() in Books Online.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация