Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2006, 07:20 AM
Authorized User
 
Join Date: Aug 2005
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select Newest entry

How can I select from a table the newest entry

 
Old February 22nd, 2006, 07:56 AM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use @@IDENTITY (Transact-SQL).

Example:

INSERT INTO Production.Location (Name, CostRate, Availability, ModifiedDate)
VALUES ('Damaged Goods', 5, 2.5, GETDATE());
GO
SELECT @@IDENTITY AS 'Identity';

See the following link for more details: http://msdn2.microsoft.com/en-us/library/ms187342.aspx

- A.Kahtava





Similar Threads
Thread Thread Starter Forum Replies Last Post
Always a New entry scandalous Access 3 January 26th, 2007 04:02 PM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
Returning the newest date in CR? johnyo101 Crystal Reports 0 November 18th, 2004 06:31 PM
Newest Topic/Post by: [MemberID] WOPR BOOK: ASP.NET Website Programming Problem-Design-Solution 7 September 5th, 2004 02:26 AM
Finding oldest to newest dates hcweb Classic ASP Basics 8 February 23rd, 2004 11:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.