Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with nulls.

Status
Not open for further replies.

manohars

Programmer
Feb 28, 2004
97
US
We have the system of defining all the Primary field data type to varchar(10) in our database, and the field values will be generated by the application. But most of the data stored are numbers only and will be in the sequence like 1,2,3,..etc. The reason why we have defined like this is we may get the requirement like prepending PK value with some alphabetic constants.

We need to port some data from excel sheet to this SQL Server database. In the excel sheet, we store the PK value also(For testing purpose). But when we port the data from excel sheet to SQL Server, it says, "Insert Error, column 1 ('product_id', DBTYPE_STR), status 10: Integrity violation: attempt to insert NULL data or data which violates constraints.
Unspecified error".

Though the data is available in excel sheet.

Can anyone help me?

Thanks in Advance,
Manohar
 
You probably have some extra rows at the end which it thinks are part of the spreadsheet.

Try inserting into a staging table (I usually use all character columns) then insert the valid rows from there.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top