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
 General SQL Server Forums
 New to SQL Server Programming
 Hresult: 0x80004005

Author  Topic 

SalasJ
Starting Member

15 Posts

Posted - 2011-07-28 : 16:38:23
Hi Guys,

so I am trying to perform an import/export from an excel sheet to a table which I already created and specified my fields but is not letting me do the import is giving an error like:

Hresult: 0x80004005 and also "Cannot insert the value NULL into column 'Id', table"

I am making the column not NULL because this the PK column and I wanted to make it automatically but when I do the import it say that I need to enter a value

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-28 : 17:28:22
For the Id column to be automatically filled in as you are importing it, you would need to make it the identity column.

If it is identity column, you can import the data, for example using the Import/Export Wizard, and the column will get populated automatically.
Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-28 : 17:36:01
yes, I figured out. I set the identity/increment to 'yes' and it worked! Thanks!
Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-28 : 17:39:57
would you able to help me with this one :(

Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "App_ID" (27) to column "App_ID" (78). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data."

I don't understand Data can be loss when converting? I have App_ID set to float because data is just text.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-07-28 : 18:57:08
quote:
Originally posted by SalasJ

I don't understand Data can be loss when converting? I have App_ID set to float because data is just text.

What is the actual datatype of the App_ID column in your table? Is it an INTEGER, FLOAT, (N)VARCHAR or (N)CHAR?
Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-29 : 15:30:13
is float...
Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-29 : 16:19:26
is that datatype okay?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-29 : 16:33:23
>>I have App_ID set to float because data is just text.
>>is that datatype okay?

Not if your data is text characters. Float is a numeric datatype so you can't set it to a character tyep value.

Be One with the Optimizer
TG
Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-29 : 17:00:43
so my App_ID contains only letters - what datatype should I set it as?

Thanks for your help!
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-07-29 : 17:28:11
quote:
Originally posted by SalasJ

so my App_ID contains only letters - what datatype should I set it as?

Thanks for your help!

Probably VARCHAR assming you don't need to support unicode characters. There is also NVARCHAR, CHAR and NCHAR (and I suppose SYSNAME, but I wouldn't use that).
Go to Top of Page
   

- Advertisement -