User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 455,974 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,766 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 797 | Replies: 3
Reply
Join Date: Nov 2007
Posts: 2
Reputation: Shalinko is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Shalinko Shalinko is offline Offline
Newbie Poster

Question Backup db to external hd?

  #1  
Nov 30th, 2007
Recently had to re-install all of pc...not a prob as all (except db) was backed up to seperate hd. I develop locally using MSSQL client tools and adp's and then upload new tables as and when ready. I had done quite a bit of work when pc died, and now have to recreate half a dozen tables plus repopulate data.
Can I make a 'create table' sql code which I can then run to restore tables, or is there another way?
Thanks in advance.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: KSA
Posts: 147
Reputation: kb.net is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Backup db to external hd?

  #2  
Dec 9th, 2007
Hi,

There are 2 ways, detach, backup, and attach. Or generate Script.
First the first one you will need to right click database and in all tasks sub menu choose detach database. Now go to the C:\Program Files\Microsoft SQL Server\MSSQL$\Data\ and look for the data base name. You will find two files with different extensions. Copy them to the new computer in the same folder and repeat the first step but this time choose Attach DataBase. you will be prompt for DB path and name. Navigate to the folder and choose the .MDF file and that is it.

The easier way is to right click database choose generate script from All Tasks sub menu and the Press show all to choose out the objects you need to script. Press OK and you will be prompt to save the SQL file in some where. Take this file and run it using SQL query Analyzer on the destination computer and it will work.
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote  
Join Date: Nov 2007
Posts: 2
Reputation: Shalinko is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Shalinko Shalinko is offline Offline
Newbie Poster

Re: Backup db to external hd?

  #3  
Dec 10th, 2007
Thanks very much for that kb, I noticed from you pp that you familiar with Windows apps, would you by chance know if I can import data from MSSQL into an excel file.
Reply With Quote  
Join Date: Aug 2007
Location: KSA
Posts: 147
Reputation: kb.net is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Backup db to external hd?

  #4  
Dec 10th, 2007
Hi,

You have to ways either export data from MSSQL to Excel or import it from excel to mssql:
For the first choose the database >> right click >> All tasks >> Export data >> choose the data source (the server and data base name) >> press next and choose the destination (Destination as Excel instead of SQL server and then the file name) >> choose the tables to export and press OK.

The second way is to open the excel file >> choose data >> Import External Data >> Import Data >> choose the data source (in your case New SQL Server Connection.odc) >> choose the database and then the tables and that is it.
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 9:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC