Missing run button and use dropdown from SSMS? - sql-server

Using Microsoft SQL Server Management Studio 18.
I have somehow lost the run button on my toolbar, along with the dropdown to select what database I am running my script against. I now have to work with a remote Azure database and would really like having that dropdown showing what context I am in.
This is what my toolbar currently looks like
I have tried Windows->Reset Window Layout and I tried clicking arrow at the far right of the toolbar->Add or Remove Buttons->Reset Toolbar, but neither of these seem to restore what I am missing.
How can I get back my run button and the Database selector dropdown to select what my script is running against?

You can follow those steps
View -> Toolbars -> [choose] SQL Editor

Related

How do I stop Database deploy from removing Server Triggers?

I am deploying my database using a Visual-Studio database project and the Publish wizzard.
The initial deploy works fine and my database is the same as my project. I then apply a third party tool to my database which adds triggers to all my tables.
I then deploy an update to my database and it removes the third party triggers from my database.
how do I stop my deploy from removing triggers that are on the server but not in the project?
I have tried unticking "Drop DML triggers not in source" in the Advance Deployment Settings but this has not worked.
Anyone else have any ideas?
PS:
I am using Visual studio 2015
The rest of my deployment settings are as follows:
So I found the problem.
When I was setting my Advanced Deployment Properties I was doing it by:
Right Clicking Database - Properties
Going to debug tab (there is no Deploy tab in 2015 like the documentation mentions)
Changing my Deployment Options here using "Advanced" button at the bottom.
I then realised that when I clicked Publish on my project there was an Advanced button on here.
Clicking the Advanced button on the Publish dialog showed different options to what I was getting on the projects properties.
I removed the Drop DML Triggers check from this screen and it worked
In addition to this. I then clicked Save Profile and added it to my project using Add Existing Item I then used this answer to set this profile as my default publishing profile

SQL Server: Is it possible to pin a query to the toolbar?

I run a query very often and was wondering if it's possible to pin that query to the menu bar or toolbars of SQL Server for easy access?
Or does anyone have an alternate solution they use?
EDIT: Using Microsoft SQL Server 2012
Create a custom template and then you can easily access it from the Template Explorer in SSMS
To create a custom template
In Template Explorer, navigate to the node where you would like to
store the new template.
Right-click the node, point to New, and then click Template.
Type the name for your new template and then press ENTER.
Right-click the new template, and then click Edit. In the Connect to
Database Engine dialog box, click Connect to open the new template
in Query Editor.
Create a script in Query Editor. Insert parameters in your script in
the format . The data type and
value areas must be present, but can be blank.
On the toolbar, click Save to save your new template.
https://technet.microsoft.com/en-us/library/ms179334(v=sql.105).aspx
If you are not using one of those 3rd party tools, like redgate's SQL Prompt, then:
You could save your query as an SQL script,
When you launch SSMS,open the .sql file that you saved, connect to the server and select database that you want to run your SQL script on,
Now you can keep that tab open in a new horizontal or vertical tab if
you wanted to, switch to it anytime you want to run and press F5
It is not pinning to toolbar but well enough IMHO.

Any way to change look-n-feel for query windows? Just jacked up production

After avoid disasters for a few years, my luck finally ran out.
I had a few query windows open (one of them on our production server which I forgot about). Thinking I was on our dev server, I did all sorts of nasties and totally hosed our production database.
Any BKM's on how you folks keep this from happening?
All advice appreciated!
Open up SQL Server Management Studio
On the View menu make sure that Registered Servers is visible (alternatively hit CTRL+ALT+G
In the Registered Server panel expand Database Engine
Right-click Local Server Groups
Chose New Server Registration
Fill in your necessary server details and then switch to the Connection Properties tab
Click on the Use custom color checkbox
Select the colour to be used. I tend to chose bright-red for live servers and green for development environments.
Save your Registered Server.
Next time you open a query on this connection the status bar at the footer should show the colour you selected.
IMPORTANT: If you change the connection of a query window (option in the right-click context menu) the colour of the status bar does not change. Just be careful out there!
Specially for such case I have added "Important DB Alert" function into my SSMS add-in called SSMSBoost.
You can "save" your production and development databases and assign them different colors. Whenever you change your connection to "Important DB" you will be warned with additional tooltip, appearing in SQL Editor window.
The feature is described here:
http://www.ssmsboost.com/Features/ssms-add-in-preferred-connections

How to remove cached server names from the Connect to Server dialog?

Or, to put it another way, where is SqlStudio.bin for SQL Server 2012? It doesn't seem to be in the place that would be expected by looking at this other SO question.
As of SQL Server 2012 you no longer have to go through the hassle of deleting the bin file (which causes other side effects). You should be able to press the Delete key within the MRU list of the Server Name dropdown in the Connect to Server dialog. This is documented in this Connect item and this blog post.
To be clear, since a couple of people seemed to have trouble with this for months: You need to click on the Server name: dropdown, and down-arrow or hover with your mouse until the server you want to remove is selected, and then press Delete. In this screen shot, I'm going to press Delete now, and it will remove the server ADMIN:SHELDON\SQL2014 from my MRU list. Note that because I merely hovered with my mouse, this is not even the server that is showing in the Server name: text box.
Note that if you have multiple entries for a single server name (e.g. one with Windows and one with SQL Auth), you won't be able to tell which one you're deleting.
Found it!
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\SqlStudio.bin
So the answer is as before: delete the file, or use some nifty PowerShell magic to edit it.
As for SQL Server Management Studio v18 it appears this file is now XML and you can edit it directly:
%APPDATA%\Microsoft\SQL Server Management Studio\18.0\UserSettings.xml
If you want to remove particular account or update password on Windows 10 then you can go to Windows Credentials in Credential Manager and update or remove related entry:
Control Panel >> Credential Manager >> Windows Credentials >> Microsoft:SSMS
This is the best way to clear these server names from the list.
Open the(SSMS) version. Mine is 18.
You should be right where you can see the server name dropdown list.
If not, you will open the Connect to Server dialog located in the File menu bar
Click on the Server Name field dropdown list.
"Hover over" (very important) the items you want to remove.
Pressing the delete (DEL) key on your keyboard should do the trick.
You're welcome

Sql Server Management Studio Object Explorer disappeared - missing - vanished

The SQL Server Management Studio Object Explorer menu disappeared. The shortcut F8 and the view->object explorer method neither do anything. I have clicked everything on the keyboard, googled around, but nothing.
I really need this back, it's a massive hassle having to navigate through the summary window without the object explorer tree view!
I just had this, and the menu option...
Window > Reset Window Layout
...worked a treat.
I have seen this same problem when double-clicking on a SQL file when SSMS is not already open. When this happens, an SSMS console gets opened automatically, but none of the windows are present, and some of them cannot be enabled. To avoid this, simply open SSMS first, and THEN click on the SQL file you were trying to open.
Tools --> Options --> Keyboard --> Keyboard --> Top Drop Down list click change from (Default) to the other one such as Visual Studio 2010 Compatible. Click ok.
After this options settings is edited and F8 is pressed the object explorer will open.
Stellar question. One option is to edit the Keyboard Options within SQL Server Management Studio.
Hope that helps people!
[Windows] -> [Auto Hide] helped me
Are you sure it isn't actually somewhere else on screen (i.e. has been clicked and dragged somewhere else?)

Resources