Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I import data from a TSV file with SQL Server 2008.

null is replaced by 0 when I confirm a table after import with integer column.

How to import as null, please Help me!!

share|improve this question
    
you mean csv??? –  Nick Kavadias Jul 7 '09 at 5:57
    
TSV = Tab Separated Values. –  mrdenny Jul 7 '09 at 6:09
    
What technique are you using to import the file? BCP, Bulk Insert, SSIS? –  mrdenny Jul 7 '09 at 6:10
    
derrrr.. i knew that ! –  Nick Kavadias Jul 7 '09 at 7:12
add comment

1 Answer

up vote 1 down vote accepted

IF you are using a BULK INSERT, did you specify the KEEPNULLS parameter?

BULK INSERT MyTestDefaultCol2
FROM 'C:\importin.txt'
WITH (
  DATAFILETYPE = 'char',
  FIELDTERMINATOR = '\t',
  KEEPNULLS
);

MSDN SQL SERVER DEV CENTER

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.