mardi 26 août 2014

Select latest inserted record in SQL Server


Vote count:

0




My table has (SubId, QId, Question, AnswerOptions, Ans). SubId is a foreign Key and QId is Primary key. my need is select latest inserted record and display it in to text box. I already tried to this Queries *select * from tblQuestions select SCOPE_IDENTITY () select max(QId)from tblQuestions select top 1 QId from tblQuestions order by QId desc* but i get the first record,( when i inserted at the first time), even i tried MAX() it shows the value 1, i tried min() it shows 1 also. how to i get latest value? Note: the latest value is Maximum value of the QId.



asked 46 secs ago







Select latest inserted record in SQL Server

Aucun commentaire:

Enregistrer un commentaire