Thnks in advance
Hi,
getdate() function sets the date with curent time along with it,i need to select the largest date with largest time (mean most recent entry among set of entries with same date)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pradeep WPosted Dec 28, 2010, 7:55 AM
In SQL Server you can have a column of datatype datetime or timestamp and use getdate function to store the entry time for that record.
Now to get the latest entry record you can use the query
Select Top 1 column_name From TableName order by column_name desc
here column_name is the name of the column of datatype datetime or timestamp
Manikavelu VelayuthamPosted Dec 28, 2010, 6:32 AM
Date range
January 1, 1753, through December 31, 9999
Time range
00:00:00 through 23:59:59.997
These are the maximum date and time range that sql server supports.
Madhu KPosted Dec 28, 2010, 6:30 AM
select top 1 date_column from tablename order by date_column desc