SQL Server Basic Operations

Source: Internet
Author: User
Tags mssqlserver create database

1 Enter the following command to start, stop, or pause services from the SQL Server command line.

The SQL Server command line is as follows:

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

2. Create a database

Create database with SSMS CREATE DATABASE (visualize) in SQL Server any visual behavior is performed in the background as a SQL statement T-sqluse master;--use the primary database Database name on (name=n ' logical name ', filename=n ' path \ filename. mdf ', SIZE=10MB,FILEGROWTH=1MB) log on (name=n ' logical name _log ', filename=n ' path \ FileName _ Log.ldf ', size=10mb,filegrowth=10%); go--Go is not the fame in the SQL statement, he is the notification database will execute the preceding statement script in conjunction with the use database name;

  

3. Create a table

Use database, CREATE table schema name. Table name (field 1 type 1 NOT null or NULL, field 2 type 2 NOT NULL or NULL, field 3 Type 3 NOT NULL or null,...); Go-> how the data in the table describes the string type char (number) ASCCII code character, fixed-length character if the length of the input data is not enough to fill the end of the space char (1)       char (10) 123,456,789,012,345 Advantage, You do not need to consider the calculation disadvantage when inserting data, occupy the resource nchar (number) Unicode character set, the structure is consistent with char nchar (10) is 10 Unicode characters position 1.,234,567,890,123,46e,+19 varchar (number) ASCCII encoded, using variable lengths, as long as the number is not more than the varchar (1NVARCHAR) text and ntext storage large text data (in future SQL Server no longer support) varchar (max) and nvarchar (max ) Supplement: The maximum length of char and varchar in the standard is 8000 byte  standard nchar and nvarchar maximum length is 4,000 characters  but varchar (max) is not the same as nvarchar (max)

  

SQL Server Basic Operations

Related Article

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.