A learning method SQL Server code

The operation of using SQL Server Management Studio, the top of the interface can generate sql script code.

Such as when creating a new database:

CREATE DATABASE [db_New] ON  PRIMARY 
( NAME = N'db_New', FILENAME = N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\db_New.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'db_New_log', FILENAME = N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\db_New_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)

You know the code to create the database, create database db_New

Common code as follows: [] may be added from time to increase

Create a database create database db_New

use db_New into the database

create table Table_2 (creating tables

ID  int  IDENTITY(1,1) NOT NULL,
[Name] [varchar](10) NOT NULL

  )  

drop table Table_2 delete table

delete the database drop database db_New

 

Guess you like

Origin www.cnblogs.com/xixixing/p/11209336.html