Navicat sql 语句创建表 导出表结构

Navicat sql 语句创建表 导出表结构

Navicat sql 语句创建表   


---Navicat sql 语句创建表
CREATE TABLE WBB(ID NOT NULL PRIMARY KEY,
                 NAME char(100),
                 sex char(100))


-------------------------------------------
-------------------------------------------
-------------------------------------------


--- Navicat 导出表结构

--- 右键 表 , dump SQL file -> structure only  得到下面的语句

//  数据库基本信息
/*
 Navicat Premium Data Transfer

 Source Server         : sa
 Source Server Type    : SQL Server
 Source Server Version : 10001600
 Source Host           : 172.20.60.100
 Source Database       : JLCollectionCustomer
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 10001600
 File Encoding         : utf-8

 Date: 10/23/2017 15:24:11 PM
*/

-- ----------------------------
--  Table structure for WBB  表 WBB 的表结构
-- ----------------------------

--- 如果 表 WBB 存在, 删除已经存在的表
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID('[dbo].[WBB]') AND type IN ('U'))
    DROP TABLE [dbo].[WBB]
GO

--- 创建表 WBB(ID,NAME,sex)
CREATE TABLE [dbo].[WBB] (
    [ID] int NOT NULL,
    [NAME] char(100) COLLATE Chinese_PRC_CI_AS NULL,
    [sex] char(100) COLLATE Chinese_PRC_CI_AS NULL
)
ON [PRIMARY]
GO


-- ----------------------------
--  Primary key structure for table WBB  添加主键
-- ----------------------------

ALTER TABLE [dbo].[WBB] ADD
    CONSTRAINT [PK__WBB__3214EC272C3393D0] PRIMARY KEY CLUSTERED ([ID]) 
    WITH (PAD_INDEX = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON)
    ON [default]
GO

-- ----------------------------
--  Options for table WBB  其他选项
-- ----------------------------
ALTER TABLE [dbo].[WBB] SET (LOCK_ESCALATION = TABLE)
GO

    原文作者:iOS_愛OS
    原文地址: https://www.jianshu.com/p/aa3b30719d7f
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞