Join | Login | Why Join?   
SQL Server, Oracle, DB2, Sybase, MySQL Help - SSWUG.ORG HACKER SAFE certified sites prevent over 99.9% of hacker crime.
Search SSWUG:   
 
Access to 509 free guest articles, discussions and more, just create your free SSWUG User ID:
Email address:  
This will be your login ID - we'll email you your password - you'll even receive the newsletter, opt-out at any time.
Email to Friend //  Discuss Article //  Rate Article //  Digg Article //  Add to Del.icio.us //  Add to Technorati

Full site membership is required for this article. Already a full member? Login here.
You currently have a guest membership. You can upgrade to full site membership here (free trial available).

Optimize Your Application Using a Timestamp


 Article Abstract:

(Ben Taylor) The TIMESTAMP data type is an often miss-understood and under-utilized feature built into SQL Server. Adding a TIMESTAMP column to your tables can increase the performance of your transaction databases. This article tells you why and how.

 Read this article...

 Related Articles - For Members.
All Articles By Author

Update Methods Used in SQL Server 6.5
Stored Procedures Administration
Tips for using SQL Server 2005 stored procedures
Optimizing Stored Procedures To Avoid Recompiles
Automate Query Development With Templates
Informix Dynamic Server locking, Part 1: Understand locking behavior and analyze locking conflicts in IDS
Force all source code objects for Re-Compilation
Enhance Your Transaction Flexibility With Embedded Stored Procedures
Handling Concurrency issues in ADO.NET (Part II)



Key (Please note):
(R) - registration may be required for access at the target site
($) - target site may require paid membership for access to this or other content


Reader Comments: Post Your Comments/Feedback

RE: Optimize Your Application Using a Timestamp
(posted: 6/21/2005 9:26:02 AM)
Great article, but I think you should've pointed out that the timestamp column gets updated even if none of the data values in the row change. If the user changes their mind about making a change and hits Save anyway, then the TS column thinks the row has changed when actually nothing has.

DECLARE @TSTABLE TABLE (IntId int NOT NULL, TS timestamp NOT NULL)
INSERT @TSTABLE (IntId) VALUES (1)
SELECT * FROM @TSTABLE
UPDATE @TSTABLE SET IntId = 1 WHERE IntId = 1
SELECT * FROM @TSTABLE



RE: Optimize Your Application Using a Timestamp
(posted: 6/22/2005 9:00:47 AM)
Thanks for your comment. It is true that the TIMESTAMP is always updated every time a record is inserted or updated. ADO is intellegent enough to know not to update if nothing was modified. But if you always update, even if there is no change required, SQL Server will update the TIMESTAMP. This method is in contradiction to the whole purpose of the TIMESTAMP column in the first place. But it is true. BT



Email to Friend //  Discuss Article //  Rate Article //  Digg Article //  Add to Del.icio.us //  Add to Technorati

   




 

[ Register ] [ Webcasts ] [ Podcasts ] [ Newsletter Archive ] [ RSS/Feeds ]
[ About ] [ Advertise ] [ Contact ] [ Privacy ] [ Terms of Service ]
[ Link to SSWUG ] [ List Server Archives ] [ Recent Orig. Content ]
(c) 1997-2008, Bits on the Wire, Inc.  (0)

Some names and products covered by SSWUG are the registered trademarks of their respective owners.
DAA10354WWW004