Showing posts with label spread. Show all posts
Showing posts with label spread. Show all posts

Friday, March 30, 2012

How Can I Restore a Database to Different Files and ...............

Hi,

I have a database that over time has become spread over different files, file groups all of various sizes.

I want to restore this database to a different set of files/filegroups and evenly spread.

It appears that I can only resotore a database to number/of and size of files from which it was backed up..

I want to redistribute a 40GB file, using EMPTY is taking for ever and then eventually fails.

What can I do?

Thanks for your help

Try adding several new data files, then doing a shrink-empty on the big file to get it to be spread out to the new files. If the big data file is your primary data file, that will not work.

Suggestion two is to Rebuild the clustered index for several of your larger tables into the new files. This will move the data.

Wednesday, March 7, 2012

How can i import a excel spread sheets to a database?

How can i import a excel spread sheet information to a table?

Regards

Karen

Save it as a CSV file(comma seperated values). Each line will refer to a row in excel. Then know the order of the cells in excel and loop through all the lines in the csv file and insert into database. If there is a value missing for one of the fields then two commas will appear next to each other. Just make sure you don't have commas in your data. You can also change the delimeter to use instead of a comma if you do happen to have commas in your data. Hope this helps.

Eric

|||

Eric,

Thanks for ur answer. Actually i am building a website where the user will upload 5-6 excel spread sheets.. and i want to save that excel sheet, i am using a file upload control, and then i want to just take the spread sheet they provide and load it in to a sql server database... so is saving it to .csv file the only option. Any ideas will be appreciated.

regards

Karen

|||

Its the only method that I'm aware of. The problem stems from the cell titles in Excel not being the same column name in a sql database. Also the dataformats might not be the same. Sorry but its the only way I know and the safest. You may want to do some more research though.

Eric

|||

Thanks for ur input, But i will be creating tables in my sql Server database... that will match the excel spread sheet. How bout running a DTS a package that transfer a data thru a stored procedure?

Regards

Karen

|||

Its worth a shot. Im sorry but I'm not too familiar with exporting excel to sql server. I've done it a few times through stored procedure where I loop through lines in CSV and import data, but thats about it.

Eric

|||

Hi Karen, did you have a look at this article...http://davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx

And this:http://support.microsoft.com/kb/321686

|||

Karen,

Bullpit's method is a much better approach. I would go with that one.


Eric