Friday, November 9, 2012

Use Variable with Top in Select In Sql

 Use Variable with Top in Select In Sql:

This is something i knew but forget to logged in my blog. But when my some one asked me for same I googled and found answer this time i am going to log it for myself and who ever comes to check my blog.

declare @i int =10

select  top (@i) * from dbo.tblviewsource

It will return top 10 records from table dbo.tblviewsource.

Happy Living....
Happy Concepts....
Happy Programming....

No comments:

Post a Comment