![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? |
#3
| |||
| |||
|
|
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? |
#4
| |||
| |||
|
|
I am not sure - I created it as an import from Excel. |
#5
| |||
| |||
|
|
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? |
#6
| |||
| |||
|
|
"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? |
|
I am not sure - I created it as an import from Excel. How can I check? |
![]() |
| Thread Tools | |
| Display Modes | |
| |