Link to home
Start Free TrialLog in
Avatar of Praveen_Bobbili
Praveen_BobbiliFlag for India

asked on

Archiving Sql data into file System

I have a sql database, need to archive the database into filesystem(excel files).

Is the size of the data will increased or not when i migrate to filesystem?

I am doing archive through c# and save into files.

Some of the experts suggested the data of the filesystem is more as compared to the sql data.

is it right or wrong
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Ermmm
There is the overhead of the excel file - so saving one byte into an excel file will result in a file significantly larger than one byte.  Saving one MB will result in only a little more than one MB of file space.

Note that also the disk space is in blocks of fixed size.
eg.  If that size is 4096 bytes then files of 1 byte and 4095 bytes  both reduce the disc space available by the same amount.

However the game is made more complex if you can compress the excel file.

Conclusion.  You need to try it and see.  (With discs the size they are it probably makes no difference in reality, what is a MB or two when the disc is TB capacity).
Silly question but why would you want to "Archive" SQL database data into Excel files?
You might be interested in backing up entire database:
http://msdn.microsoft.com/en-us/library/ms187510(v=sql.100).aspx
Avatar of Praveen_Bobbili

ASKER

I don't want to backup entire database.

I may select 1000 records or Entire table and want to save excel or csv,

It increases the size of the files compared to the database Size.

How its happening??
>>How its happening??

Have you read the first comment concerning your question.
Avatar of movendra
movendra

may be you can use sqlcmd command line utility to create a csv file you can open with excel:
sqlcmd -S <server_name> -E -d <db_name> -Q "select * from <table_name> " -s ";" -o "c:\output_file_name.csv"

you can call it from a c# program with "Process.Start"
I've requested that this question be deleted for the following reason:

Could find own solution
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial