Solved

prevent import of empty rows from Excel

Posted on 2008-06-20
1
951 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

724 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