Solved

prevent import of empty rows from Excel

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

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…
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
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

737 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