SQL Server Export Sample of 100 Records

Posted on 2012-08-19
Last Modified: 2012-08-20
I would like the step-by-step instructions on how to export (extract) about 100 Records from an existing SQL Server Database (Microsoft SQL Server 2008R2 64-Bit) that contains thousands of records. One of our software developers has requested that we extract a sample of the existing SQL Server Databse and forward (ftp) it to them for testing.

I have limited exposure/experience with SQL Server and have attempted to locate this process using SQL books without any success.

Question by:ECSI06
    LVL 65

    Assisted Solution

    by:Jim Horn
    >about 100 Records from an existing SQL Server Database
    Assuming you mean 100 records from a table

    -- This will return some number around (above?) 100 random rows from any table
    SELECT column1, column2, column3
    FROM YourTable
    TABLESAMPLE (100 rows)
    LVL 9

    Accepted Solution

    Assuming the database name is AdventureWorks2008R2

    1.Right-click the AdventureWorks2008R2 in SQL Management Studio
    2.Go to Tasks and then Export data, you'll then see an easy to use wizard.
    3.Your database will be the source, you can enter your SQL query

    USE AdventureWorks2008R2 ;
    SELECT FirstName, LastName
    FROM Person.Person

    4.Choose Excel(or anyone from the list) as the target
    5.Run it at end of wizard
    LVL 75

    Assisted Solution

    by:Anthony Perkins
    You can also use this approach (fix the obvious typo in xSELECT)
    xSELECT TOP(100) Col1, Col2, Col3, ...
    FROM YourTableName

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now