• Home
  • About
  • BestBloggingIdeas
  • DotNetLearningSource
  • FORUM
  • Joblinks
  • Latest News
  • Policy
  • POSTS
  • SimplySqlServer.Com && SimplyAspDotNet.Com
  • Sitemap

Join Ours Forum

Asp.Net,C#,Ajax,Sql server,silverlight,Javascript codes exambles articles,Programming exambles

RSS Feed
  • Bounty Huge Roll [Amazon Frustration-Free Packaging]
  • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
  • The Basic Overview of Windows Mobile Development Asp.Net C#
  • Overview of Sql server extended properties Asp.Net C#
  • How to Use Sql Server Extended properties using visual studio Asp.Net C#
  • Adobe Dreamweaver Templates Accelerate Web Development
  • Top Tips for Web Design Projects
  • How to Achieve a Good Web Design Structure
  • To Use Or Not To Use Website Templates
  • Five Tips to a Successful Website
  • Top 10 Articles,


    Silverlight Datagrid Select Update Delete Insert Asp.Net C#

    Differences Similarities Benefits Between Typed Datasets and Untyped Datasets asp.net c#

    Linq to Sql Introduction Entities Ado.Net C# SqlClasses Attributes Linq Mapping

    Linq Programming/How Linq Works?/Linq Implementation In Asp.Net C# Ado.Net

    Performing Developing Using Investigating Asp.Net 2.0 Ajax Application Development Asp.Net C#

    Hosting/Install Wcf Services in a Windows Service Asp.Net C#

    Connecting Silverlight to Wcf Asp.Net C#

    Silverlight Data Grid Data Binding WCF Asp.Net C#

    Invoking/Accessing/Calling WCF Service Without Adding/Creating Proxy/Reference Asp.Net C#

    Performing Doing Creating Insert Update Delete sql data Using Linq Database Asp.Net C#

    New “TOP” keyword Enhancements in SQL SERVER 2008

    Posted by on April 7, 2010 Leave a comment (2) Go to comments

    Introduction:
    In this article,i am going to explain about the new “TOP” keyword enhancements in SQL SERVER 2008.

    Main:

    In SQL Server 2000 and earlier versions, TOP allows you to limit the number of rows returned as a number or a percentage in SELECT queries. As of SQL Server 2005, you can use TOP in DELETE, UPDATE, and INSERT queries and can also specify the number (or percentage) of rows by using variables or any valid numeric returning expression (such as a subquery). The main reason for allowing TOP with DELETE, UPDATE, and INSERT was to replace the SET ROWCOUNT option, which SQL Server traditionally didn’t optimize very well.

    You can specify the TOP limit as a literal number or an expression. If you’re using an expression, you must enclose it in parentheses. The expression should be of the bigint data type when you are not using the PERCENT option and a float value in the range 0 through 100 when you are using the PERCENT option. You might find it useful to create an expression for TOP and make it a parameter that you pass in to a stored procedure, as shown in below,

    Using TOP enhancements in a stored procedure

    CREATE PROCEDURE uspReturnTopOrders(@NumberOfRows bigint)
    AS
      SELECT TOP (@NumberOfRows) SalesOrderID
       FROM Sales.SalesOrderHeader
       ORDER BY SalesOrderID

    Executing the stored procedure is easy. Just pass in the number of records you want (in this case, 100), as shown here:

    EXEC uspReturnTopOrders @NumberOfRows = 100

    Here are the results:

    SalesOrderID
    ————
    43659
    43660
    43661
    43662
    43663
    :

    (100 row(s) affected)

    Using a subquery can be powerful when you’re doing things on the fly. The following example shows how to get the TOP n orders based on how many rows are in the SalesPerson table:

    SELECT TOP (SELECT COUNT(*) FROM Sales.SalesPerson)
      SalesOrderID, RevisionNumber, OrderDate
     FROM Sales.SalesOrderHeader
     ORDER BY SalesOrderID

    Because there are 17 rows in the SalesPerson table, the query returns only the top 17 rows from the SalesOrderHeader table:

    SalesOrderID Revision NumberOrderDate
    ————- ——— ————————–
    43659 1 2001-07-01 00:00:00.000
    43660 1 2001-07-01 00:00:00.000
    43661 1 2001-07-01 00:00:00.000
    43662 1 2001-07-01 00:00:00.000
    43663 1 2001-07-01 00:00:00.000
    43664 1 2001-07-01 00:00:00.000
    43665 1 2001-07-01 00:00:00.000
    43666 1 2001-07-01 00:00:00.000
    43667 1 2001-07-01 00:00:00.000
    43668 1 2001-07-01 00:00:00.000
    43669 1 2001-07-01 00:00:00.000
    43670 1 2001-07-01 00:00:00.000
    43671 1 2001-07-01 00:00:00.000
    43672 1 2001-07-01 00:00:00.000
    43673 1 2001-07-01 00:00:00.000
    43674 1 2001-07-01 00:00:00.000
    43675 1 2001-07-01 00:00:00.000

    (17 row(s) affected)

    Using the PERCENT option is just as easy. Just add the PERCENT keyword, and make sure that your variable is a float. In below 2-20, we’re asking for the top 10 percent, so we’ll get back 3,147 records because the AdventureWorks2008 SalesOrderHeader table has approximately 31,465 records in it.

    Returning TOP percentages

    DECLARE @NumberOfRows AS float
    SET @NumberOfRows = 10
     
    SELECT TOP (@NumberOfRows) PERCENT *
     FROM Sales.SalesOrderHeader
     ORDER BY OrderDate

    Conclusion:
    Hope this helps,
    Happy Coding.

    SQL SERVER/ORACLE
    ← How to Accessing/Using/Use the PIVOT and UNPIVOT Operators in Sql Server 2008
    How to Create/Develop/Add Ranking Functions in SQL Server 2008 →

    Learn Easily Using Video Tutorials


    How to choose the right Java IDE – explained Eclipse NetBeans BlueJ

    Developing/Creating/Performing/Configuring Java Applications Using Eclipse IDE

    Step By Step Guide for Download/Install Configure Eclipse IDE for Java

    Editing data with the GridView control Asp.Net C#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Best way to prepare asp.net Interview - Success Stories

    Download Important Questions and PPT's:

    Sql Server Important Questions Online free download

    Dotnet Important Questions Online free download

    Exploring Linq to Sql Process Flow

    Learn how to perform silverlight programming

    Learn OOPs concepts in better and well manner

    Learn Ajax in better and well manner

    Leave a comment

    2 Comments.

    1. Julianne Uselton July 26, 2010 at 10:02 am

      Im obliged for the blog.Really thank you! Great.

    2. Christen Nakahara August 12, 2010 at 8:25 pm

      good!it’s very useful!thx!

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    *

    *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Enter your email address:

    Delivered by FeedBurner

    • Recent Posts

      • Bounty Huge Roll [Amazon Frustration-Free Packaging]
      • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
      • The Basic Overview of Windows Mobile Development Asp.Net C#
      • Overview of Sql server extended properties Asp.Net C#
      • How to Use Sql Server Extended properties using visual studio Asp.Net C#
    • Search by Tags!

      Application AspNet Basic between Black Bluetooth Build Business Collection Consultants Design Development Downloading effective Excel Experts Generics Implement Installing Interview Logic Management Microsoft Minutes Object Outlook Professional Programmer Programming Project Projects Questions Ready Select Server Services Silverlight Source Strings Studio Through using Visual Website Wordpress
    • Archives

      • August 2011
      • June 2011
      • May 2011
      • April 2011
      • March 2011
      • February 2011
      • December 2010
      • November 2010
      • October 2010
      • September 2010
      • August 2010
      • July 2010
      • June 2010
      • May 2010
      • April 2010
      • March 2010
      • February 2010
      • January 2010
      • December 2009
      • November 2009
      • October 2009
      • September 2009

    Copyright © 2012 NetProgrammingHelp.com

    Δ Top