1

I am new to sql scripting. I have a problem where I sometimes run a standalone mode that doesn't allow a connection from my database to my actual program. I am trying to automate a way to take the data out of my sql server database and push it to my program somehow. Just as a backup.

Is this possible?

5
  • which DBMS are you using ? Commented Oct 2, 2013 at 17:27
  • SQL Server MAnagement Studio Commented Oct 2, 2013 at 17:30
  • 1
    This should help: fmsinc.com/free/NewTips/SQL/SQLServerExpressDatabase/… Commented Oct 2, 2013 at 17:33
  • Awesome. What if two people are remotely working on this together. And I want to send them a script to get the data out for them? Commented Oct 2, 2013 at 17:36
  • See my edit in answer below Commented Oct 2, 2013 at 17:47

1 Answer 1

1

Source: fmsinc.com/free/NewTips/SQL/SQLServerExpr..

Download and install the SQL Server Management Studio Express interface from the following URL (if you do not already have this utility installed on your server): http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&displaylang=en

Please note that an installation of SQL Server Express does not install this interface (at the time this article was created for the 2005 version). This is a separate download.

Open the SQL Server Management Studio Express interface.

Create a new backup device using the wizard (expand Server Objects => New Backup Device).

Right click on the new backup device and select the database that you wish to backup.

Select the backup type (most often this is “Full”).

Choose a name for the job. Insert a description if you would like.

Click the Add button to add a Device Destination (this is where you would like the backup .bak output file to be placed).

Click Ok. The backup device is now setup. Repeat steps 3-7 for each database that you wish to backup.

Create a batch file using the following syntax (this is used to execute the backup device).
A syntax example is below (remember to save this file with a “BAT” file extension):

===< Begin Code Batch Script  >===
sqlcmd -S MYSERVER\OFFICESERVERS -E -Q "BACKUP DATABASE MASTER TO TEST"
===< End Code Batch Script >=====
..where “MYSERVER” is the name of the SQL Server machine.
..where “OFFICESERVERS” is the name of the SQL Server.
..where “Test” is the name of the backup job.
..where “MASTER” is the name of the database.

Finally, open the Microsoft Windows Scheduler and assign the batch file created above to a scheduled event. Set the event to run at the point you wish.


EDIT: As you asked if 2 peoples are working remotely - in that case one will be server or both will be clients. What you can do is to create backup file on Server & the get that backup file for client OR in other case define 2 different Jobs & set their starting points for each of them. A backup file will be created for each job that will be executed & get that from destination for each client.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.