?
Solved

prevent import of empty rows from Excel

Posted on 2008-06-20
1
Medium Priority
?
978 Views
Last Modified: 2011-10-19
I'm using Enterprise Manager to import data from excel into a SQL server table into my database.  The import works but the process tends to import extra empty rows from the excel sheet that I do not want.  So for example: If my Excel spreadsheet has three rows of data that I want to import, it's actually importing rows 1 thru 4000.  What's the easiest way to prevent this.  I would prefer not to have to create a custom SQL statement if I can avoid it.  I much prefer using the wizard to transfer the information.
Any ideas would be appreciated.
0
Comment
Question by:xamian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 19

Accepted Solution

by:
folderol earned 2000 total points
ID: 21834114
You need to save your wizard session as a dts package.  Save it to local server.  Click Data Transformation Services, Local Package, and right click your package, select design.

You need to change the radio button for Connection: to SQL QUERY, then modify the query with a where clause that will skip the blanks.  See attach screen shot.

For a painless ad hoc method, you need to clean up the range that is being imported.  The ODBC driver looks at usedrange, the rectangle of bottom row, rightmost column found with the same logic that sort and filter commands on the Excel Data Menu use to determine the table dimensions to manipulate, and it also will select a named range, if one exists.  You can get around this by pasting your data to a new sheet or new workbook before importing.  The SQL wizard will stop adding blank rows that appear below the data.
DTS-wizard.bmp
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

770 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