Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 06:36 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Importing from excel with missing data

Hi,

very new to DTS and would appreciate some help.

I would like to import an excel s/s to a number of tables. Unfortunately the s/s has gaps where the creator of the s/s has left out the ID field, where it is a repeat of the field above i.e. row one will have an ID entry in field1, if row 2,3,and 4 are entries for the same ID, then the field is left blank.

Would the best way be to audit the s/s beforehand to ensure that all fields are filled or is there a way fill these in during the DTS process? if so, any example code would be appreciated.

many thanks


 
Old September 14th, 2004, 12:55 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Does the ID field in your excel spreadsheet have any significance?

If not, you can add your own identity column on your database and omit id key field during during the transformation process.

 
Old September 15th, 2004, 03:29 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
thanks for replying ...
the ID field is the field required for the lookup i.e. Row 1 will have an entry in the ID field, say customer number; the following 4 rows will have nothing in this field as all entries are for the same customer number. The customer number would be needed to look up the relevant code to allow the data to be insertd into tables - giving a problem with those rows where the field is empty.

many thanks

 
Old September 15th, 2004, 04:06 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

How many records do you have in the excel sheet?
Is there any other field in your excel sheet that can uniquely identify the customer. If there is, import your data using dts and in the data transformation build your table from the excel sheet on make sure identity insert is not selected. make sure the field which has the customer number allows nulls

for example this your database table

pkkey int identity
cust_no int null
cust_name varchar null

when you move your data update your table with the customer number value corresponding to the matching null value records.

If you do not have many records, update your excel sheet first.

you may also consider creating a linkedserver to your excel work book and then using open query update the excel sheets.

Information on how to setup a linkedserver is available in Books Online
 
Old September 21st, 2004, 07:02 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

many thanks .. I will give it a go






Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Excel Data into a new Dataset Juan Patrick Visual Basic 2005 Basics 2 July 4th, 2007 09:03 PM
Problem importing XML data to Excel bluerattle XML 2 July 3rd, 2007 03:35 PM
Problem importing XML data to Excel bluerattle Excel VBA 0 July 3rd, 2007 03:34 PM
problem in importing data from excel to sql hiren1977 General .NET 0 January 2nd, 2007 06:00 AM
Importing data from excel sheet to databaase jvraman SQL Server 2000 3 May 12th, 2006 12:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.