Tuesday, May 4, 2010

How to get a column from the last record inserted in SQL

I was in real need for getting a particular column value for the last record inserted. After running through many hints provided in the internet, I came up with the following solution:

Used this forum as a starting point:

If there is a column called login in the table tb_admin, to select the value of a particular column of the last row inserted, this is the query :

SELECT login from (select top 1 * from tb_admin order by recid desc) as tempTable

Here "top 1 *" will give the first record and order by recid desc will order it in the descending order to get the last record.

Monday, May 3, 2010

Installing NAV 5.0 SP1 on Windows 7

I recently migrated to Windows 7 from Windows XP. Most of the software updates were going smooth with suitable notifications if anything was missing, but when I tried to install NAV 5.0 SP1, I got a strange error message, but minutes later I got a notification that I had to upgrade my SQl Server 2005 Express to, SQL Server 2005 SP3.
Since NAV 5.0 SP1 installs a SQL Server 2005 Express, I was hoping that the service pack may be the cause for the strange error. I got it downloaded and ran it, everything was fine since then.