SQL Server Common command-line operations (start, stop, pause) _mssql

Source: Internet
Author: User
Tags mssqlserver
Start SQL Server
Net Start MSSQLServer
Pausing SQL Server
Net Pause MSSQLServer
Restarting a paused SQL Server
Net Continue MSSQLServer
Stop SQL Server
Net Stop MSSQLServer

to modify the password of the SQL Server SA by command line

has been using Enterprise Manager operation of SQL, yesterday to help a friend deployment site, leasing foreign VPS host, landing up to see only the normal operation of the SQL icon, Enterprise Manager and Query Analyzer's shadow did not see, Khan a ... Space providers also do not give technical support, dizzy, only to find a way to their own.
Google online today, finally done.
Under the cmd window
Copy Code code as follows:

C:\Documents and SETTINGS\ADMINISTRATOR>OSQL-E
1> sp_password null, ' abc123 ', ' sa '
2> Go
Password changed.
1> exit

The SA's password was modified to abc123
The key is osql this dongdong, concrete view http://msdn.microsoft.com/zh-cn/vstudio/ms162806.aspx

SQL Server command line tools isql and osql common commands

Command-line operations are sometimes more efficient than using the mouse in a graphical interface, so master command line operations are common, and SQL Server command-line tools isql and osql are briefly introduced below.
The isql utility allows you to enter Transact-SQL statements, system procedures, and script files, and communicates with SQL Server 2000 using Db-library.
The osql utility allows you to enter Transact-SQL statements, system procedures, and script files. The utility communicates with the server through ODBC.
Trust connection:
>isql-e
Or
>osql-e
View all databases:
Use master
EXEC sp_helpdb
Go
View database pubs:
Use master
EXEC sp_helpdb Pubs
Go
View objects in pubs in the database:
Use pubs
EXEC sp_help
Go
The equivalent of Oracle's SELECT table_name from user_objects;
Look at the table employee structure in the database pubs:
Use pubs
EXEC Sp_help Employee
Go
Equivalent to the DESC employees in Oracle's Sql*plus
SELECT statement:
Use pubs
SELECT * FROM Employee
Go
When using single quotes to separate a constants of characters that include embedded single quotes, enclose single quotes in two single quotes, for example:
SELECT ' O ' Leary '
Go
Use 7 double quotes to embed double quotes, for example:
Select ' O ' Leary '
Go
SQL Server Database Information query
Use master
EXEC sp_helpdb Pubs
Go
Or:
Use master
SELECT name, dbid from sysdatabases
Go
Check database objects (equivalent to Oracle's SELECT * from User_tables;)
Use pubs
EXEC sp_help
Go
Or
Use master
SELECT name, id from pubs.dbo.sysobjects WHERE type= ' U '
Go
Check fields (equivalent to DESC employees in Oracle's Sql*plus)
Use pubs
EXEC Sp_help Employee
Go
View the specified
Use pubs
SELECT name, ID, xtype, length
From syscolumns WHERE id=277576027
Go
Use pubs
SELECT *
From syscolumns WHERE id=277576027
Go
To view the definition of a data type name:
SELECT name, Xtype
From systypes
Go
To start Query Analyzer from the command line
>isqlw
isql command description
Go executes all statements entered after the last go command.
RESET clears all the statements that have been entered.
ED invokes the editor.
!! command to execute operating system commands.
QUIT or exit () exits isql.
CTRL + C to end the query without exiting isql.
This can only be recognized when the command Terminator Go (default), RESET, ED 、!!、 EXIT, QUIT, and CTRL + C appear at the start of a line (immediately following the isql prompt). ISQL ignores any content entered after these keywords in the same row.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.