Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your information in this site is absolutely WONDERFUL. It is the most useful site on the web to me right now. Thank You Thank You..."

Geography

Where in the world do Tek-Tips members come from?

Importing from Excel - Nulls for blank varchar fields & Ref Integrity

LucieLastic (Programmer)
3 Aug 11 7:13
hi

I'm trying to import a spreadsheet.  One of the columns has all text data with the odd blank cell and the appropriate field in the DB has a referential integrity constraint on it.  For blank XL cells, I need a NULL to be inserted but sql server, I believe, is trying to import a blank string (ie  ''), so the contraint fails.  How can I force it to set it to NULL for blank cells?

I've also tried saving as CSV and importing that but I get the same problem.

MAny thanks
Lou
drlex (TechnicalUser)
4 Aug 11 7:09
Lou,
How are you doing your import?
If you're using OpenRecordset, you can change the behaviour of the import - see http://support.microsoft.com/kb/194124/en-us

Personally, the combination of user and Excel behaviour causes me to sanitize data imports by way of an all varchar temp. table. Keeps processes running and also acts as a source to advise of data rows that failed to be imported.
 

soi là, soi carré

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close