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.
Related
I'm trying to migrate one of my database in my local environment to Azure from SQL server management studio, but i'm facing with the following exception.
Please let me know how to resolve this issue. Thanks
Steps I have followed:
From SQL Server Management Studio, Database -> Tasks --> Deploy database to Windows Azure SQL Database
I'm able to connect to the Azure SQL instance
During the process i'm getting the following error, as in the snapshot.
PFB the snapshot of my local and azure SQL server instances,
Right click on the DB you are trying to copy, select "Generate scripts..." to open the "generate and Publish Scripts" wizard.
Click Next or "Choose Objects" from the navigation pane to the left. On the "Choose Objects" step you may want to select the specific tables/sprocs you want to copy, or you can just choose "Script entire database"
On the next page, I recommend selecting the "Save to a New Query Window" option. Then click "Advanced" in the top right corner and scroll to the bottom of the "General" section. The last item in this section is "Type of data to script". You will probably want to change this to "Schema and data" if you want to include the data in your script.
Click Next until it starts to generate the script. When the script is done, it will open a new query window with CREATE / INSERT statements and when you Execute, it will create a copy of your DB. HOWEVER, you will need to update the USE [MyDatabase] statement and you will need to change the "Available Databases" dropdown to the desired Database (i'm talking about the dropdown box above the Object Explorer)
You can use the following methods:
-dacpac
-In Visual Studio -> Tools - SQL Server - SQL Schema comparison & data comparison
Check in the settings windows - use incompatible platforms
You received that error because the version of SSMS you're using is old. Installing the latest version of SSMS will get things working better.
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.
I created a database named sample in SQL server management Studio 2008 and created a table too. But When I wanted to connect to the created database from the Visual Studio 2010, it did not show my created database.
All I did is I clicked ..
Tools --> Connect to Database --> Selected the server name --> Clicked 'Use Windows Authentication'---> clicked the drop down list of 'Select or enter a database name'.
It dint show my created database sample but showed master, model, msdb, Reportserver, reportserverTempdb, Tempdb.
If I enter the database name, I get the following error:
"This connection cannot be tested because the specified database does not exist or is not visible to the specified user"
What could be the problem and how do I solve it? I am looking forward to solve this problem as soon as possible.
Hope you must have resolved this... otherwise I followed the following steps
Goto SQL Server Object explorer
Add the SQL server - your_pcname\SqlExpress
Add the new database
Create tables into it
Then - try to create the connection; it should show the new database created.
For someone who came here just like me, in my sql server, there was a failed restore attempt of the same database. It said XYZDatabase (Restoring...). The issue got resolved when I deleted that failed restore.
Mention the correct server name of the specific database to which you want to connect.
Open SQL Server > Right click on the database which you want to connect > properties> Click View Connection Properties (In the left side written in blue color)> There is the server name, copy that and paste it in the Connection Server Name in Visual Studio Project on which you want the data.
I hope this helps.
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
Say I already created my database but forgot to save the sql commands do create it.
How could I reverse engineer the code from an already existing database?
I'm using Microsoft SQL Server Express 2008.
You can do this pretty easily by using SQL Server Management Studio (SSMS) - it's available for free if you don't already have it installed.
Connect to the database
Expand out Databases > YourDataBaseName.
Right-click on the database and select the option "Script database as" then "Create To" then finally "File".
That will create the necessary scripts to recreate your database.
To script out all the tables in your database:
Right-click on the database node
Select "Tasks" then "Generate Scripts".
When the wizard appears, click Next.
Select the database. At this point you can check the "Script all objects in the selected database" which does exactly what it says, or if you leave it unchecked you will get the option later in the process to pick which items are scripted.
Click next. Now you're given some scripting options.
I'd suggest scrolling down the list and checking the option to Script Indexes/Script Triggers. You can also script the data if necessary (though I wouldn't do this if you've got a lot of data in your database).
Modify any options you'd like and click Next.
Select the database types you'd like to script (Users/Tables/Views). Click Next.
Now you've got the opportunity to select more specific items. Hit Next and repeat the process of any of your other database types.
Hit next one more time, then select where you'd like the script written to. You get the chance to review your selections.
Click Finish.
Here's a link for the 2008 version SSMS Express 2008
Your RDBMS comes with some sort of "dump" tool that will give you the structure and content of your database, in the form of SQL statements.
As others have mentioned, if you have SQL Management Studio (you should, it's free as part of SQL Server Express). Fire it up, connect to your instance then expand the Database tree.
Right click on your database and select Tasks->Generate Scripts..
Click next, then Next again (which selects all objects in the database by default), pick an output option (defaults as "Save to File"), click next and voila!
If you also want to script the data as well as the schema, in the "Set Scripting Options" window, click on the Advanced button, scroll down to "Types of data to script" (just above the Table/View Options header) and select "schema and data".
[Edit] Tested - The Generate Scripts option exists and works in the (free) 2008 R2 edition of SSMS. See the link in my comment below for the URI for the R2 version.