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 2005 Forums
 Transact-SQL (2005)
 Cannot insert the value NULL into column 'ID' SSIS

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2009-02-24 : 02:27:39
Hi

I try to import data from a csv file using DTS, but when I review data type mapping there are exclamation marks in front of all columns telling me "potential lost conversation from string [DT_STR]" to nvarchar. Why is that, what can be wrong?

Update..
I changed the DT_STR to DT_WSTR and got rid of the nasty exclamation marks, but now I get another error when I try to run it, The error is "Cannot insert the value NULL into column 'ID', table 'mytestdb.dbo.CoData'; column does not allow nulls. INSERT fails."."

But the ID is a PK with identity increment so why do that fail?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-02-24 : 04:17:24
The insert must not adress the ID that is a PK with identity increment.
That's all.

Greetings
Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2009-02-24 : 04:29:43
But that column is not displayed when I look at the column mappings, and I cannot access the "edit sql" button beacuse it is greyed out...
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-02-24 : 05:04:47
Is it DTS or is it SSIS?
Where appears the "edit sql" button?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2009-02-24 : 05:27:09
Hi

I run Tasks-import data - Sql Server import and export wizard.
The "Edit sql" appears when I "select source tables and views" and press "edit mappings"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-02-24 : 05:39:12
The "edit sql" button is disabled because you don't need to create the destination table (and only that is what this button can show you).

Be sure NOT to check the "Enable identity insert"


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -