SQL Server - How to open sql server command prompt

Asked By aman on 08-Sep-11 01:33 AM
hi all,

i want to open sql server command prompt but i am unable to do so........

thanks
smr replied to aman on 08-Sep-11 01:53 AM
Hi

The syntax of this sqlwb is very simple. I will copy complete syntax from BOL here :
sqlwb

[scriptfile] [projectfile] [solutionfile]
[-S servername] [-d databasename] [-U username] [-P password]
[-E] [-nosplash] [-?]


I use following script very frequently.

1) Open SQL Server Management Studio.
sqlwb


2) Open SQL Server Management Studio with windows authentication with no splash screen and default database as AdventureWorks
sqlwb -E -S SQLServerName -D AdventureWorksnosplash


3) Open SQL Server Management Studio with username and password with no splash screen and default database as AdventureWorks

sqlwb -S SQLServerName -U MyUserName -P MyPassWord -D AdventureWorksnosplash

To execute above commands you should have access to sqlwb.exe file. My local computer has sqlwb file in folder :

C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE

Click on Start >> click on run >> type in following command to launch SQL Server Management Studio :
“C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\sqlwb.exe” -E -S SQL -nosplash
Reena Jain replied to aman on 08-Sep-11 06:02 AM
Hi,

SQL Server 2005 is actually a service running behind, so you can start and stop the instance of SQL Server by starting or stopping the service.

Run the following command to run or stop the SQL Server
 
To Start SQL Server 2005 – run the following command at run prompt   
    net start mssqlservaer
To Stop SQL Server 2005 – run the following command at run prompt   
    net stop mssqlserver

Hope this will help you