Saturday, July 11, 2009

On Export & Import to SQL Server

I had this situation where I’ve to migrate data in a couple of tables into another database. Both are SQL Server 2005 and I cannot do it now, b’coz the other is production and the operation should happen over a release.

So ideally I’ve to write an insert script but it’s a lil more data (a couple hundreds) which will be very painful to manually write.

I tried to explore the Export and Import option and When I 1st tried export it gave me some product list not supported. Then I installed SP2 which solved the issue.

Then I tried import and it was throwing some validation exception. I tried using Flat file but in vain.

Later I once again tried export with excel this time Edited mapping and I converted the Long text to varchar but note that the varchar has just 255 as a limit in excel. Its ok for me since I dint have long data.

Now I imported and it worked fine but here again I faced a lil issue The Datetime in the excel dint have the precision to milliseconds but its kind of ok b’coz I don’t need that precision for my data.

I later heard that the TFS DataBase edition has a Database compare but it wil work only if the table has a primary key.

No comments: