How to find SQL Server name in logging in to SQL Server Management Studio - sql

How can I create a server name for database engine in logging in to SQL Server Management Studio?
Or how can I find my default server name? I have been using running SQLCMD -L this code in my command prompt but it turns me nothing it just says Servers:

You can try using Localhost or . to connect to your local instance.
Also, to reattach your database (from the mdf file), you can use the Attach Database command that is showed in the following image.
Hope this helps

Related

Create New SQL Server Database in Visual Studio 2017

I am using Visual Studio 2017. From data connection when I create new SQL Server database, a pop up open and ask for server name. I refreshed but no server name display. What is the solution?
I found my answer. From the SQL Server Object Explore, Right Click "Add New Server" Then click to local and select server. After selecting the server i found server name. I copy the servername from here
and paste it to paste it to
"create new sql server database" server name field.. And set database name. Finally it works!
Install SQL Server, SQL Server Express, or LocalDB on your current computer or a computer in your network.
Explanation
SQL Server Data Tools provides you with a client application that you can use to connect to SQL Server instances.
However, it does not include a server instance (a Database Engine Instance). In order to have anything populate that list (namely servers), you have to install one of the above options on a machine in your network that you can connect to.
you can use localDb...
create a new connection with the following in your connection string:
Data Source=(localdb)\MSSQLLocalDB;
Integrated Security=True;
then you can create new DB inside visual studio:

SQL Server Management Studio 2008 connects to SQL 2012 localdb

is it possible to use SQL Server Management Studio 2008 to connect to instances of SQL 2012 localdb?
I have installed the 2012 Native Client, which contains the ODBC driver, but I still can't seem to use the SSMS 2008 to connect to my localdb instance.
I have no problem using the sqlcmd to connect to the localdb, so it is not the server problem.
Thank you
You could do it via named pipes this way:
1 - Get the address of a (localdb) instance by running the following command: "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SqlLocalDB.exe" info [InstanceName] (if its the default instance you're interested in, specify v11.0 as the [InstanceName] You can write it in CMD to text file with the command:
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SqlLocalDB.exe" info v11.0 > C:\db_details.txt
2 - Copy the "Instance pipe name" value, e.g. np:.\pipe\LOCALDB#1E0FF40B\tsql\query
3 - Paste the "Instance pipe name" value as the Server Name.
Install CU6 on system with SSMS 2008R2 as it contains some fixes related to compatibility issues with SQL Server 2012.
If you can see the 2012 server in your SSMS 2008R2 than you have connected it.
Open a new query window and execute the following code:
select ##version
try this :
ip Address\sqlserver2012 in the server name.
then set the Authentication method = SQL Server Authentication and provide thw login and password fields.

Cannot login to sql server 2008 R2 after rebooting server

I am using Windows-server-2008 with Microsoft SQL Server 2008.
And there are a lot of questions about this, but nothing on the internet solved it.
The problem is that i can't connect to the my SQL Server 2008 R2 after rebooting my server.
I placed some new memory in my server, and after rebooting my client/server application didn't work anymore because it cannot reach the database.
So i tried to get in SQL Server Management Studio (SSMS), and tried to loggin with Administrator and another user but both do not work.
When i logg in the following message is displayed:
Cannot connect to (local)
A network-related or instance-specific error occurred while establishing a connection
to SQL Server. The server was not found or was not accessible. Verify that the instance
name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 2)
I Tried a lot of different things like:
Rebooting server
Try to start the server manually from Sql Server Configuration Manager
Named Pipes - Enabled
TCP/IP - Enabled
Tried to create an new system user or database user as described in the following article: Click Here
Can somebody please help me? I am really confused because i need to get this online. Otherwise i have to reinstall the database server but i do not have a back-up. (is there some folder with a back-up of the settings/tables/columns are stored and can be imported from reinstall?
I was having the exact same problem. net start mssqlserver was giving me the blurb about a failed login attempt. The problem was that I had recently changed the password for the administrator account, and the new password didn't get updated in services.
Here's how I fixed it:
First locate SQL Server from the list here:
Right click and select properties, and navigate to the Log On tab:
Then I typed the new password, and like magic I was able to start SQL Server right through the services manager.
I also did this for any other processes which were marked as "stopped" even though Startup Type was marked as "automatic" (namely, SQL Server Agent).
Is it a named instance or default? Also, is this a local instance? (I see the "(local)" but just wanted to make sure.)
Start the sql server services from services.msc and try to connect

Automatically view specifc database in Management Studio

We have an SQL database that is hosted remotely and I use SQL Server Management Studio to manage everything. Being that we are on a shared server there are many other databases on the same server. Is there a way to automatically expand the object explorer to my database upon connection? or possibly filter the databases to show only mine?
Specifying the "Connect to database" in the Connection Properties does not achieve this.
There are a few command line switches for Management Studio here
The exe is here on my PC:
"C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe".
Use the -U switch to specify a login and -S to specify a server and this will open a new query file connected to this logins default database. This can be changed using the alter command, i.e.
alter login sa with default_database = master
This isn't quite connecting Object Explorer but it may help with what you are trying to do.

Connecting to SQL Server 2008 Express from VB 2008 Express

I'm using VB 2008 Express for our College Project. I'm also running SQL Server 2008 Express and have installed SQL Server Management Studio and used it to create my database.
Both software have been installed and running locally. I'm trying to connect to the database from VB 2008 Express. Database connection wizard have 3 options:
connecting to Access db
connecting to SQL Server 3.5 compact db and
connecting to SQL Server db file.
There are no problems connecting to the first two but when I try to connect to my SQL server DB file (.mdf) it throws the following error ("Unable to open the physical file .... Operating system error 32:(failed to retrieve text for this error. reason:1815.......an attempt to attach an auto-named database for file ...... .mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share")
I appreciate if anyone who had the same experience and overcome the problem could point me in the right direction.
Thanks very much.
Little Critter.
You need to detach your database from the server. Since you created the file there it is already running on the SQL Express server. Operating System Error 32 is a sharing violation and it means that the file is in use.
Try this:
Open Sql Express 2008 Managment Studio and find your database in the Object Explorer tree.
Right click on your database, choose tasks, and then select "Detach"
When the "Detach Database" dialog appears, select the checkbox that says "Drop Connections"
Click ok.
Your database should detach from the database server. Now the server will no longer bring that database up automatically and you should be able to get exclusive access to it.
Note that if you want to make more edits to the MDF you will have to reattach the database or you will need to use the tools built into VB 2008 Express. Because of this most people would choose to leave the database attached and not run it as a "User Instance". Check out this link for alternative ways to get to your data: How to: Access and Initialize Server Explorer/Database Explorer.
Anyway, you may have your reasons for setting it up this way. The steps outlined above should fix you up. Good luck with your project!