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

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

Related

Deleting a SQL Server from the list in SSMS

I have a SQL Server instance that I'd like to remove from the list that shows up in the available servers in Object Explorer. How do I do this?
Assuming you mean the dropdown list of servers when making a new connection you simply highlight the row in the dropdown and hit delete.
Here is simpliest way to clear items from this list.
Open the Microsoft SQL Server Management Studio (SSMS) version you want to affect.
Open the Connect to Server dialog (File->Connect Object Explorer, Object Explorer-> Connect-> Database Engine, etc).
Click on the Server Name field drop down list’s down arrow.
Hover over the items you want to remove.
Press the delete (DEL) key on your keyboard.

SQL Server Management Studio does not use color in text editor

I currently have an issue with my SSMS since my PC has been reformatted with windows 10. It doesnt show any functions name with the correct color (should be pink), string (should be red), JOIN (should be grey), etc.
The only keyword it recognize are SELECT, INSERT, PRINT, TRANSACTION and couple more. I checked into my font & colors settings and they are set correctly. I even reinstalled twice without any difference.
EDIT:
Here is an image of how it look like, its a link because i am not allowed to embbed an image directly
EDIT2:
Here is my settings on SQL System Function
I finally found the solution. My Tools -> Options -> International Settings -> Language was set to "Same as Microsoft Windows" which is French. But the rest of my interface is in English. I guess there is a bug where the Setting are in French, but the Editor in English and cant find the color coding properly.
Hope it can help anyone with this problem!
if you would like set all the color back, 1.Tools -> 2.Option -> 3.Environment -> 4.Choose Text Editor in Show setting for, choose Use Defaults if this does not work, than the same steps above, but choose 'Keyword' in Display items in step 4, choose any color you prefer.
UPDATE
Update, GETDATE() and etc are not in keyword catalog, they are in SQL System Function,check that again
2nd UPDATE
In the SSMS, View - Registered Servers to check whether your local Server get registered in Database engine, if you do not see you local computer name shown in Local Server Groups, right click that, hit Task, then Register Local Server
3rd UPDATE
I think you need to restart SQL server database engine instead of restating SSMS only, you could restart it by right click the database engine name, hit restart, if that does not work, try to reboot your local machine

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

adding a new column in SQL SERVER but it is not showing up in access

access is the front end and sql server 2008 is the backend
i am opening the specific table in access. i have no problem editing data in this table using sql server and then displaying the changes in access; however, when i add a new field in sql server, the changes are not reflected in access.
i am opening the table as a datasheet and it is not showing the new field that i added in access. ive opened and closed the file and still doesn't work
anyone know what's going on here?
You might need to refresh the SQL Server table in Access using Linked Table Manager.
I cannot add comment but I like to add...
since it irritates me.
It is the same story not only in MS Access, it is the same in SSMS (MS SQL Server Management Studio, even from the latest MS SQL Server 2008 R2) with its own "native" mdf databases and tables from it.
If to change the content of a table through another window / tab or instance of SSMS (by TSQL, or by interactive editing) then the content shown in already opened for interactive editing table is not updated, though it is updated by non-documented Ctrl+R.
And it is not available in GUI of SSMS (no menu entry, no button, etc.)!!!
Any browser/webapp can be easily configured to update the content but not MS desktop IDE GUI!!!
But if to ALTER TABLE, for ex., to add a column, then already opened tab with table (SSMS) cannot reflect the changes (cannot show altered table, for ex., with added column) even by pressing Ctrl+R.
It is necessary to close tab (window) with table and reopen it
(right-clicking on table in SSMS ObjectExplorer --> Edit tio 200 rows)!!!
I remeber I opened a bug in Microsoft Connect feedback on it and it was closed as this was a feature "by design"!
Still IMHO it is a bug and requires brute force (/ugly GUI actions) to bypass it
This SO Q&A seems to cover similar territory.

SQL Server 2008 SSMS won't remember password

SQL Server 2008 doesn't remember password inspite of checking the "Remember Password" checkbox.
I was suspecting a reboot would solve the problem. But, the issue persists.
Environment: Windows Vista Ultimate, SQL Server 2008
I have been hesitant to post this, as it seems so trivial and weird.
There is a solution for this in SSMS 2012 that worked for me. Microsoft now provides a mechanism for removing a server from the list of remembered servers, and removing the offending server from the list will allow you to save the password the next time you connect to it:
In the Connect to Database Engine dialog, drop down the server name list
Use the arrow keys to select the server for which passwords aren't remembered
Press the delete key on the keyboard.
https://web.archive.org/web/20160216044501/http://blogs.msdn.com/b/managingsql/archive/2011/07/13/deleting-old-server-names-from-quot-connect-to-server-quot-dialog-in-ssms.aspx
If you register the server, and connect to it that way (just a quick double click), it works great!
In SSMS -> View | Registered Servers
Choose "Database Engine" (should be selected by default)
Right click on "Local Server Groups" and choose "New Server Registration" (or create your own group first if you prefer)
Enter all required details: Server address, username, password, tick "Remember password" box, Registered server name
Click "OK" -- now you can always connect to this server from this "Registered Servers" tool window - it will not ask for a password again.
I got this from serverfault.com and it worked great!
Does this bug report match what you're seeing?
EDIT (January 10, 2015): Ganesh points out in a comment that this link is now dead. This decade-old bug was closed as “Won’t Fix,” but it has been reposted/reopened here. (I put a screenshot of the cached page here, for anyone who’s interested.)
I believe I found the solution to this problem.
If your SQL Server seems to have forgotten your passwords, try this:
At the log on screen, click on the down arrow of the Logon selection box.
Do not select a logon name right away.
Wait a few seconds.
Then select the logon name from the list.
Your password will appear in the password box.
Why does this strange behavior occur? I believe SQL Server may have to poll accounts and does not do it in time when you click immediately on the log on name.
The SSMS 2012 answer didn't work for me since I'm on 2008 R2. However, I did find a way to "fix" it. It's not a true fix, but if you keep a backup of the file, you can always restore it very easily if one of the servers loses your credentials.
Important Note:
While playing around trying to find out WHY/WHEN it actually does lose credentials, I found that it seems to always remember the last used username that has never been used for that specific server using your profile. For example, if you start with a fresh profile, and you connect to a server called MyServer, and you begin by using sa for the username, regardless of if you check "remember password" or not, if you log in successfully with sa, it seems that SSMS now stores that in memory. Now if you use the username Tester and log in successfully, it will always open by default with Tester as the user.
Now for the fix/workaround:
First, check out this article, but I recommend that you DON'T DELETE the file, just rename it to SqlStudio.bin.OLD or something, so you can always restore it to check any settings that would have been reset using this method.
MY Approach:
I first renamed my bin file like I recommended. Then, I opened SSMS and logged in to every server that I use most often, using the credentials I always want to use for those servers, and selected "Remember password" for each one. I then made a BACKUP of the bin file, and store it in a secure place on my network. This way, if I ever need to log in to a server with another username for testing or whatever, I can easily restore my original bin file afterward. Or, if you want, before you use the new username, you could just rename the bin file and do your work as the new user. Once you're done, just delete the new bin file and rename your original back to .bin and you'll be good to go.
The key is to get a good version of your bin file and make a backup. If you ever add a new server, you can log in using the same approach as above, using your desired credentials and remember password, and then copy the bin file to the backup location. Hope this helps!
You can remove user setting completely and SSMS will be able to remember new logins. Be aware this way you'll lose all the saved ssms logins.
User settings location is
%APPDATA%\Microsoft\SQL Server Management Studio\[you ssms version here]\UserSettings.xml
For me, I solve my problem by running "SQL Server Manage Studio" (SSMS) by Admin right (right click, Run as Administrator) and tick check box "Remember password", type password and connect.
Then the next time I run SSMS normally and boom, no need to type password again.
It seems that SSMS have problem writing credential and run as Administrator do solve it.
This worked for me:
I went to Control Panel -> Credential Manager, in the "Windows credentials" category then "add a Windows credential" and manually created a record with:
IP
User
Password
and then SSMS started to remember the password

Resources