| Author: sree 28 Apr 2007 | Member Level: Silver | Rating:  Points: 2 |
SELECT MAX(identity) from Table WHERE identity NOT IN ( SELECT TOP 2 identity FROM Table ORDER BY identity DESC ) this command gives u the second max identity no
|
| Author: Vadivel Mohanakrishnan 28 Apr 2007 | Member Level: Diamond | Rating:  Points: 2 |
Make use of IsNull() function to return 0 when there is no record. More over you need to show us the query what you have written to understand your question better!
Best Regards Vadivel
MVP SQL Server http://vadivel.blogspot.com
|