dbTalk Databases Forums  

Excel sheet load

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Excel sheet load in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
baaul
 
Posts: n/a

Default Excel sheet load - 12-08-2004 , 09:09 PM






Trying to load an excel sheet into a table having 3 columns. Two of its
column are composite keys. Getting an error on the load transformCopy:
Destination does not allow NULL on colum Pair....

appreciate any help!

-TAsh

Reply With Quote
  #2  
Old   
HWUK
 
Posts: n/a

Default RE: Excel sheet load - 12-09-2004 , 04:45 AM






Loading from excel can be full of problems unless you use the OpenRowSet
syntax. I think this problem lies with the way DTS interperates the
spreadsheet. On many occasions I use to try and import a spreadsheet with
1000 rows in it but DTS cept trying to import 1010 rows and the last 10 were
all blank. I turned out that the user had entered data into the last ten rows
and then deleted the data. DTS read this as a valid record.

I would suggest the following. Import the spreadsheet into a new table and
check the row count. If it is importing null rows use the OPENROWSET syntax.

eg.

INSERT INTO DestTable
SELECT F4 AS Customer
, F5 AS LVL
FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0; HDR=NO;
IMEX=1;Database=<FileLocation>', 'SELECT * FROM [sheet1$] where F4 is not
null ')



Reply With Quote
  #3  
Old   
baaul
 
Posts: n/a

Default RE: Excel sheet load - 12-09-2004 , 10:03 AM



Is it possible to load duplicate records into a composite key field?
Appreciate any suggestion. Thanks!


"HWUK" wrote:

Quote:
Loading from excel can be full of problems unless you use the OpenRowSet
syntax. I think this problem lies with the way DTS interperates the
spreadsheet. On many occasions I use to try and import a spreadsheet with
1000 rows in it but DTS cept trying to import 1010 rows and the last 10 were
all blank. I turned out that the user had entered data into the last ten rows
and then deleted the data. DTS read this as a valid record.

I would suggest the following. Import the spreadsheet into a new table and
check the row count. If it is importing null rows use the OPENROWSET syntax.

eg.

INSERT INTO DestTable
SELECT F4 AS Customer
, F5 AS LVL
FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0; HDR=NO;
IMEX=1;Database=<FileLocation>', 'SELECT * FROM [sheet1$] where F4 is not
null ')



Reply With Quote
  #4  
Old   
HWUK
 
Posts: n/a

Default RE: Excel sheet load - 12-10-2004 , 07:03 AM



Sure thing, as long as it's not a primary key or unique.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.