SQL Server Export Sample of 100 Records

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.

Thanks,
ECSI06
ECSI06Asked:
Who is Participating?
 
Vijaya Reddy Pinnapa ReddyConnect With a Mentor Commented:
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

Example:
USE AdventureWorks2008R2 ;
GO
SELECT FirstName, LastName
FROM Person.Person
TABLESAMPLE (100 ROWS) ;

4.Choose Excel(or anyone from the list) as the target
5.Run it at end of wizard
0
 
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
>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)

http://technet.microsoft.com/en-us/library/ms189108(v=sql.105)
0
 
Anthony PerkinsConnect With a Mentor Commented:
You can also use this approach (fix the obvious typo in xSELECT)
xSELECT TOP(100) Col1, Col2, Col3, ...
FROM YourTableName
ORDER BY NEWID()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.