Friday, March 9, 2012

Import data from csv file

I am trying to import a csv file using the import wizard. The file is 2.5 gig and I have the entire (almost 4gig) database available. I keep getting an error that I do not have enough file space. Is the flat file size not an apple to apple match for database size? Any insite would be great! Thanks in advance.

A nnn MB or GB file imported into SQL Server won't result in an exact size increase in SQL Server. There is no one formula that will give you the exact size needed to import the file. It depends on too many variables such as data types in the table, indexes, etc. But...I would suspect it's the logging of the import if you are in full recovery and are just loading this through the wizard. Normally, you would want to import that in batches or using a bulk import/load with the space you have in the database. If you need to use the wizard and can use a query to break this up in "chucks" of data, You may want to look at importing 20 - 25 % of the records, backup the log. Import another 20 - 25% of the records, backup the log, etc. You also would want to make sure your data and log files aren't set to grow by percentages - you don't have much control over the growth of the files if you have the files set to grow in percentages.

-Sue

|||

What is the size of data file and transaction log on this 4gb database?

As explained the size of data within SQL server depends on the datatype used and number of rows.

No comments:

Post a Comment