Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Data Type for Unique ID field for huge table?

Author  Topic 

phoenix22
Starting Member

20 Posts

Posted - 2004-09-21 : 09:58:38
Hi,
I have an ID field in my table of type int, length 4, and is an Identity (identity seed = 1, increment = 1).

I receive an error message when importing a CSV file "Cannot insert the value NULL in column 'ID'". Currently my table already has 1144951 records and I receive this error message on insertion of row 96011.

Is this a problem with the data type for my ID field? (i.e. it's not big enough) If so, how could I resolve this problem?

Thank you in advance.

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-21 : 10:16:06
INT supports up to 2 billion in SQL Server, so it is not the number of rows already in there. More likely you are trying to insert into the identity column from the csv w/out setting identiy_insert on first. Or there is a null in the csv file you are using.


Raymond
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-09-21 : 10:56:16
I would add NOT FOR REPLICATION

Jim
Users <> Logic
Go to Top of Page

phoenix22
Starting Member

20 Posts

Posted - 2004-09-21 : 11:05:51
Thanks for your reply. How could I set identity_insert first? I'm using the Microsoft SQL Server DTS Wizard to import my data. Thanks in advance.
Go to Top of Page

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-21 : 11:08:40
Add an Execute SQL task preceding your bulk insert task that issues the command. You should also add a succeeding task that resets the identity_insert property as well.


Raymond
Go to Top of Page

phoenix22
Starting Member

20 Posts

Posted - 2004-09-21 : 11:25:02
Sorry, I don't really understand what exact command to issue? I've already checked that "Enable Identity Insert" is enabled.
Go to Top of Page

phoenix22
Starting Member

20 Posts

Posted - 2004-09-21 : 13:16:49
I know what the problem is...the "Enable Identity Insert" option in the DTS Export Wizard should be unchecked. It works now.
Go to Top of Page
   

- Advertisement -