Open SQL Server 2012 From Command Prompt - sql-server

I have installed SQL Server 2012, SQL Server 2008 R2 and SQL Server 2014.
Now when I run SSMS it always opens SQL Server 2008.
What to do same for SQL Server 2012?
Any shortcut key or command to run from command prompt like SSMS?
Please guide me.

I found the solution. It is so simple.
Just create desktop short cut and copy that file to C:\Windows\
For example:
Create short cut named as on desktop SQL Server Management Studio Now simply copy it to your C:\Windows path and rename it to SSMS12 and now from command prompt simply type SSMS12 -
It will open SQL Server 2012.

Related

How to see Name of local server when login to SQL Server Management studio 2008?

Can anyone tell me What is the simplest way to know the Name of local server when login to SQL Server Management studio 2008 for the first time..?
I have tried some good way/solution if not anybody found some method he can try this one:
this works for me fine:
First open RUN type services.msc then go to sql server (name you
selected during installation ) like sql server (SQLServerExpress) and
start this application or restart.
You have to type command SQLCMD -L into CMD window opening as an
administrator & press enter.
Give appeared server name into sql server management studio 2008
login box as server name.

HOW to create SQL Server 2017 database scripts using sqlcmd

I have a database schema sitting in SQL Server 2017 running on Ubuntu. I have a separate SQL Server 2008 R2. I need the database structure to migrate from 2017 -> 2008 R2 server and cannot find the right direction to start with. I had created the backup and tried to restore but it seems we cannot restore in that fashion. I think "create scripts" will do the job but I do not have management studio. All I have is sqlcmd running on the instance with 2017 version. So can I run "create scripts" to get the structure of the database and store in a single .sql file.?
Check this answer: How to use sqlcmd to create a database
Here you go:
sqlcmd -i C:\path\to\file.sql
More options can be found in SQL Server books online.

SQL Server - Copy database from Server 2008 to Server 2012

I have two servers one in Denmark the other here in the UK. I need to make a copy of a database out of SQL Server Management 2008 (1st server) and place it in SQL Server Management 2012(2nd server). I have tried connecting to the remote server but have been getting difficulties so instead of connecting both up and doing it that way I was hoping there is a function like copy database which could do this for me. I have gone into tasks and copy database in SQL Server 2008 but in the Copy Database Wizard that appears it says "You can use this wizard to move or copy databases from an instance of SQL Server 2000 or later to an instance of SQL Server 2008". I'm looking for something like this that will work for Server 2012.
Copy your database file .mdf and log file .ldf and paste in your SQL Server
Install file in Programs Files->Microsoft SQL Server->MSSQL10.SQLEXPRESS->MSSQL->DATA.
Open SQL Server. Right-click on Databases then Select Attach... option.
You can create a backup with the Management Studio on the source and restore it on the target.
You need Management Studio 2012 to make this step. You can then create empty database on 2012 server. Right click on this empty DB->Tasks->Copy database..
Wizard will guide you. You should to this under 2012 Management Studio because it is compatible with 2008 Server - vice versa it will not work.
Of course, cleanest way is to do this via backup (.bak file - Tasks->Backup.. then on 2012 server Tasks->Restore->Files or FileGroups) but you need remote access (RDP) to the server.

SQL Server 2008 Management Studio Not Showing Database

I've got a fresh install of Windows Server 2008 R2 SP1 and just installed SQL Server 2008 R2, including SQL Server 2008 R2 Management Studio.
When I go into Management Studio, it does NOT show the SQL Server instance that was created during setup. It only has (local) and won't let me connect to it at all.
Any ideas?
First check if SQL Server 2008 instance is installed show on your SQL Configuration Manager.
If it doesn't exist you need to re install you sql server 2008 r2 and follow these steps on this link below:
SQL SERVER – 2008 – Step By Step Installation Guide With Images
And it exist just add server name : yourpcname
Best Regards
Problem solved. Management studio requires <computer name>/<instance name> under the "Server" section. I was only entering in the instance name.
Another solution that worked for me:
enter "localhost" as the server (computer-name\MSSQLSERVER failed)
Not sure why but the name "MSSQLSERVER" as shown in Configuration Manager is not the name shown when I log in via Management Studio. The name in Management Studio is SQL Server 9.0.5000 which corresponds to SQL Server 2005 SP4 (which is correct in my case).

Alternate option for SQL Server 2008 Management Studio Express

I am trying to install SQL Server 2008 Management Studio Express found here, but I am getting a win32 not an application error.
Is there another option for managing Windows SQL Server databases other than Visual Studio? I just have to be able to log in to the server and run some test SQL like:
ALTER TABLE test ADD column VARCHAR(50)
Can you run that query in Visual Studio? If so that would solve the problem too.
There is the command line sqlcmd utility.
The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt, in Query Editor in SQLCMD mode, in a Windows script file or in an operating system (Cmd.exe) job step of a SQL Server Agent job.
Yes, you can run ad-hoc queries to a SQL Server database from Visual Studio.
Find/create a Data Connection in Server Explorer, right-click, and choose New Query.

Resources