5

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

1 Answer 1

5

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


Testing the suggestion on the comment on express with advanced services... it worked well:) 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
6
  • I have saved the package in disk that is .dtsx file.But how to edit it?Which software to be used to edit it? Commented Jun 5, 2013 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 Commented Jun 5, 2013 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 Commented Jun 5, 2013 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) Commented Jun 5, 2013 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 Commented Jun 5, 2013 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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