• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 87
  • Last Modified:

running a script in sql

I have never done much in SQL with running scripts but I am supposed to run one today.  The instructions say I should run the .sql script against the Viewpoint database.  Viewpoint is the location of data for our accounting system.  See the screenshot and let me know where I should navigate to run the sql script.  The script is located on the desktop.
Screen-Shot-2018-01-18-at-7.36.25-AM.png
0
mkramer777
Asked:
mkramer777
  • 4
  • 3
  • 2
  • +1
1 Solution
 
Bill PrewCommented:
Is this query just to report some data, or is it updating the database?


»bp
0
 
ValentinoVBI ConsultantCommented:
What you have selected there is indeed the viewpoint database.  If you hit CTRL-N with that selected SSMS will open a new query window on that database.  Anything you run from there will be on the viewpoint database, unless you use a statement that changes the database scope (such as "USE anoter_database").
0
 
mkramer777Author Commented:
Updating the database
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
mkramer777Author Commented:
Once it brings up the new query window how do I run the script?  Do I have to open it and paste the info or do I naviagate to the script on the desktop and click execute?

Also, where is the command or process to do a backup up the SQL database?
0
 
ValentinoVBI ConsultantCommented:
To be sure I'd open it in a text editor and copy/paste it into the query window.  Opening from SSMS is another option, just check that the right database is selected which is visible in the yellow banner at the bottom of the query window.
0
 
ValentinoVBI ConsultantCommented:
Once it is open you can hit F5 to execute.  There's also a button but in your screenshot most of the buttons are hidden so to keep it simple: F5 :)
0
 
mkramer777Author Commented:
You say once it is open.  Sorry to be a dope about this.  Is the only way to get this script in the query window is to copy and paste and then execute?  Or can you run it from the desktop to this location?
0
 
ValentinoVBI ConsultantCommented:
SSMS is the tool to work with SQL Server so yes, basically it is.  There's also a command prompt tool but I don't think that's what you're after.

As for the backup question, check this: Create a Full Database Backup (SQL Server)

BTW: I'm assuming you don't have a DBA around who will come and ask you why his backup schedule has been disturbed, right? If there is one, check with that person first!
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
In SSMS, goto menu File/Open/File (or use the shortcut Ctrl + O) and locate you script file to be opened in SSMS.
Before running the script (F5 key) it's always good to perform a backup of your database so you can rollback to the moment immediately before you ran the script in case you need to revert the changes.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
mkramer777, do you still need help with this question?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now