Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am using sql server 2008 r2 express. I am getting some problems when i use import data feature to import data from one database to another. I am using SSMS to do it. While using the wizard i choose "Select identity insert" option to copy the identity element property. By using this identity elements are imported properly. But after importing i compared the source database and destination database and found some changes!!. All NULL values in the table are replaced by 0. So how can i avoid it.Is there any option to copy it as it while using import data wizard? Please help

share|improve this question
add comment

2 Answers

Choose to save the package instead of running it right away.
Then edit the dtsx file and on your copy task chek "keep nulls".
Then run the dtsx.
I didn't test it but think it will solve your case. enter image description here

share|improve this answer
    
I have saved the package in disk that is .dtsx file.But how to edit it?Which software to be used to edit it? –  IT researcher Jun 5 '13 at 11:07
    
You can drag and drop it to SSMS and it will open. Also if you have BIDS (business inteligence development studio) installed you can open it there –  user16484 Jun 5 '13 at 11:25
    
In SSMS it opens as just like xml file, if i edit it then how can i run the same package? Or how to run the ssis package which is saved? I am using sql server 2008 r2 express –  IT researcher Jun 5 '13 at 12:27
    
though dtsx's xml can be edited even with notepad (at the end of the line "FastLoadKeepNulls" you'd replace "false" with "true"), express can't run it then(msdn.microsoft.com/en-us/library/cc645993(SQL.105).aspx#SSIS) –  user16484 Jun 5 '13 at 13:26
    
This might solve it, try creating the table on the destination and setting the column's default value to null. After you have imported data set the column's default value to whatever you want. Let me know if it worked for you. Thanks –  user16484 Jun 5 '13 at 13:53
add comment

Just tested it on express with advanced services and worked fine!
You create the destination table, set a null default on the column and after importing data with the dtsx you remove the default or set it to whatever you want. dtsx import will replace nulls with the default value of the column when you can't check the "keep nulls".

create table dbo.test (
 a int null
 , other columns ...
 )

alter table dbo.test add constraint x default null for a

--Run Import task here

alter table dbo.test drop constraint x
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.