can you please help me with sql querry for 'finding last record in a table'Hi,
Inherently, a relational database table is a set. Sets are, by definition, unordered.
So every select statement will show you records in different order , i mean no order, it will be in random order.Getting the last row requires that you have some way of ordering the rows in the database.
If you do not have an identity column, you would need to have some other "identity-like" column, such as a column that holds the last modified date of a row or atleast some serial number as primary key .
Otherwise, SQL Server has no way of identifying the last record.|||Hi,
Answer for your question
-----------
select top 1 * from tablename order by column name desc
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment