Common SQL server command line operations (start, stop, pause)

Source: Internet
Author: User
Tags mssqlserver
Common SQL server command line operations to enable, stop, and pause SQL server on the command line

Common SQL server command line operations to enable, stop, and pause SQL server on the command line

Start SQL server
Net Start MSSqlServer
Pause SQL server
Net Pause MSSqlServer
Restart the suspended SQL server
Net Continue MSSqlServer
Stop SQL server
Net stop MSSqlServer

Modify the SQL server sa password using the command line

I have always used the Enterprise Manager to operate SQL. Yesterday I helped a friend deploy a website and rented a foreign vps host. After logging on, I only saw the SQL icon running normally, the Enterprise Manager and the query analyzer do not have any images. Sweat is one... The space provider does not provide technical support, and is dizzy. It is only necessary to find a solution.
Today, google is done.
In the cmd window
The Code is as follows:
C: \ Documents ents and Settings \ Administrator> osql-E
1> sp_password null, 'abc123', 'sa'
2> go
Password changed.
1> exit

As a result, the sa password is changed to abc123.
The key is osql. For details, refer

Common commands of SQL Server command line tools isql and osql

Command Line operations are sometimes more efficient than using the mouse in the graphic interface. Therefore, you are familiar with common command line operations. The following describes the SQL Server command line tools isql and osql.
The isql utility allows you to enter Transact-SQL statements, system processes, and script files, and use DB-Library to communicate with SQL Server 2000.
Osql utility allows you to enter Transact-SQL statements, system processes, and script files. The utility communicates with the server through ODBC.
◆ Trusted 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 database pubs:
USE pubs
EXEC sp_help
GO
Equivalent to SELECT table_name FROM user_objects of Oracle;
◆ View the table employee structure in database pubs:
USE pubs
EXEC sp_help employee
GO
Equivalent to DESC employees in Oracle SQL * PLUS
◆ SELECT statement:
USE pubs
SELECT * FROM employee
GO
◆ When a single quotation mark is used to separate a character constant that includes an embedded single quotation mark, two single quotation marks are used to indicate the embedding of single quotation marks. For example:
SELECT 'O' Leary'
GO
◆ Enclose double quotation marks with 7 double quotation marks, 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
◆ Query 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
◆ Query fields (equivalent to DESC employees in Oracle SQL * PLUS)
USE pubs
EXEC sp_help employee
GO
◆ View specified
USE pubs
SELECT name, id, xtype, length
FROM syscolumns WHERE id = 277576027
GO
USE pubs
SELECT *
FROM syscolumns WHERE id = 277576027
GO
◆ View the definition of the Data Type name:
SELECT name, xtype
FROM policypes
GO
◆ Start the "query analyzer" from the command line"
> Isqlw
◆ Isql command description
All the statements that GO enters after executing the last GO command.
RESET clears all input statements.
ED calls the editor.
!! Command to execute the operating system command.
QUIT or EXIT () to EXIT isql.
CTRL + C ends the query without exiting isql.
Only when the command Terminator GO (default), RESET, ED ,!! EXIT, QUIT, and CTRL + C can be recognized only when a row starts (followed by 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.