dbTalk Databases Forums  

Import From TAB File

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


Discuss Import From TAB File in the microsoft.public.sqlserver.dts forum.



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

Default Import From TAB File - 04-07-2004 , 04:03 AM






I am trying to import data into a table in my database using DTS.

The table (SYS_DD_SIC_Codes) has the following structure:

[SIC_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[SIC_Code] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SIC_80] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SIC_92] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

The import procedure works, but then fails at the very last line in the TAB
file, giving an error that it cannot insert a NULL value into [SIC_ID].

This is correct, but why is it trying to insert a NULL value when none exist
in the TAB file to insert?



Reply With Quote
  #2  
Old   
Raymond Lewallen
 
Posts: n/a

Default Re: Import From TAB File - 04-07-2004 , 12:33 PM






Keith,

Does the last line of the TAB file contain an end of file marker only, and
no other spaces, delimiters or CRLFs?

Raymond Lewallen

"Keith" <@.> wrote

Quote:
I am trying to import data into a table in my database using DTS.

The table (SYS_DD_SIC_Codes) has the following structure:

[SIC_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[SIC_Code] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
,
[SIC_80] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SIC_92] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

The import procedure works, but then fails at the very last line in the
TAB
file, giving an error that it cannot insert a NULL value into [SIC_ID].

This is correct, but why is it trying to insert a NULL value when none
exist
in the TAB file to insert?





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

Default Re: Import From TAB File - 04-07-2004 , 01:20 PM



I am not sure - I created it as an import from Excel.

How can I check?

"Raymond Lewallen" <Raymond.CTR.Lewallen (AT) nospam (DOT) faa.gov> wrote

Quote:
Keith,

Does the last line of the TAB file contain an end of file marker only, and
no other spaces, delimiters or CRLFs?

Raymond Lewallen

"Keith" <@.> wrote

I am trying to import data into a table in my database using DTS.

The table (SYS_DD_SIC_Codes) has the following structure:

[SIC_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[SIC_Code] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL
,
[SIC_80] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SIC_92] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

The import procedure works, but then fails at the very last line in the
TAB
file, giving an error that it cannot insert a NULL value into [SIC_ID].

This is correct, but why is it trying to insert a NULL value when none
exist
in the TAB file to insert?







Reply With Quote
  #4  
Old   
Raymond Lewallen
 
Posts: n/a

Default Re: Import From TAB File - 04-07-2004 , 01:41 PM



Quote:
I am not sure - I created it as an import from Excel.
With that in mind, is there a reason your not importing the Excel file
directly, but instead exporting the Excel file and then importing the newly
created file? Is it a correct assumption that the file has 3 fields to
import, and that you are expecting Sql Server to populate the ID (identity)
field on its own, or do you have Identity_Insert On for that table because
your file you are importing contains identity fields you want to use?




Reply With Quote
  #5  
Old   
Keith
 
Posts: n/a

Default Re: Import From TAB File - 04-07-2004 , 02:06 PM



I have sorted it - thank you.

I had accidentally (or maybe that should be ignorantly) ticked Identity
Insert when SQL should have been handling it.

Thank you

"Raymond Lewallen" <Raymond.CTR.Lewallen (AT) nospam (DOT) faa.gov> wrote

Quote:
I am not sure - I created it as an import from Excel.

With that in mind, is there a reason your not importing the Excel file
directly, but instead exporting the Excel file and then importing the
newly
created file? Is it a correct assumption that the file has 3 fields to
import, and that you are expecting Sql Server to populate the ID
(identity)
field on its own, or do you have Identity_Insert On for that table because
your file you are importing contains identity fields you want to use?





Reply With Quote
  #6  
Old   
DTJ
 
Posts: n/a

Default Re: Import From TAB File - 04-07-2004 , 05:34 PM



On Wed, 7 Apr 2004 19:20:21 +0100, "Keith" <@.> wrote:

Quote:
"Raymond Lewallen" <Raymond.CTR.Lewallen (AT) nospam (DOT) faa.gov> wrote in message
news:eWGD4ZMHEHA.2928 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Keith,

Does the last line of the TAB file contain an end of file marker only, and
no other spaces, delimiters or CRLFs?

Raymond Lewallen

"Keith" <@.> wrote in message
news:elxFj8HHEHA.1528 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I am trying to import data into a table in my database using DTS.

The table (SYS_DD_SIC_Codes) has the following structure:

[SIC_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[SIC_Code] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL
,
[SIC_80] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SIC_92] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

The import procedure works, but then fails at the very last line in the
TAB
file, giving an error that it cannot insert a NULL value into [SIC_ID].

This is correct, but why is it trying to insert a NULL value when none
exist
in the TAB file to insert?
top posting corrected...

Quote:
I am not sure - I created it as an import from Excel.

How can I check?

Use a hex editor. XVI is a good one.


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.