Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selected the newest record

Status
Not open for further replies.

jcg6

Technical User
Feb 18, 2002
50
0
0
US
How can I use a stored procedure to select a record that was just added to a table? I want the most recently added record...

I'm sure that there is an easy way to do this, but I am new to this and can't seem to find a solution. Any help would be appreciated. Thanks very much! [smile]
 
Create PROC LASTRECORD
AS

SELECT FIELD1,FIELD2,TIME etc
FROM MYTABLE
WHERE TIME = (SELECT MAX(TIME)FROM MYTABLE)
 
Thank you for your quick response. That was exactly what I needed to know!! [SMILE]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top