IF EXISTS (SELECT 1 FROM sysobjects o, sysusers u WHERE o.uid=u.uid AND o.name = 'Table_Name' AND u.name = 'dbo' AND o.type = 'U')
 drop table Table_Name

IF (@@error != 0)
BEGIN
 PRINT "Error CREATING table 'databasename.dbo.tablename'"
 SELECT syb_quit()
END
go

create table Table_Name(
 key_date                        int                              not null  ,
 cusip                           char(9)                          not null  ,
 description                     char(60)                         null  ,
 security_type                   char(2)                          null  ,
 security_literal                char(4)                          null  ,
 group_code                      char(1)                          null  ,
 class_code                      char(3)                          null  ,
 tax_status                      char(1)                          null  ,
 coupon                          float(16)                        null  ,
 schedule                        char(2)                          null  ,
 payment_day                     int                              null  ,
 first_coupon_date               int                              null  ,
 next_coupon_date                int                              null  ,
 dated_date                      int                              null  ,
 maturity_date                   int                              null  ,
 market_price                    float(16)                        null  ,
 market_price_nuv                float(16)                        null  ,
 hard_call_code                  char(1)                          null  ,
 hard_call_date                  int                              null  ,
 hard_call_price                 float(16)                        null  ,
 optional_call_code              char(1)                          null  ,
 optional_call_date              int                              null  ,
 optional_call_price             float(16)                        null  ,
 prerefunded_date                int                              null  ,
 prerefunded_price               float(16)                        null  ,
 put_code                        char(1)                          null  ,
 put_date                        int                              null  ,
 put_price                       float(16)                        null  ,
 muni_pcall_date                 int                              null  ,
 factor                          float(16)                        null  ,
 insurance                       char(5)                          null  ,
 cusip_state                     char(2)                          null  ,
 wac                             float(16)                        null  ,
 psa_sign                        char(1)                          null  ,
 psa                             int                              null  ,
 cpr_sign                        char(1)                          null  ,
 cpr                             float(16)                        null  ,
 call_type_code                  char(2)                          null  ,
 call_type_1                     char(1)                          null  ,
 call_type_2                     char(1)                          null  ,
 subject_amt_code                int                              null  ,
 tax_muni_code                   int                              null  ,
 current_call_code               int                              null  ,
 crossover_code                  int                              null  ,
 nuveen_code                     int                              null  ,
 yankee_bond_code                int                              null  ,
 sink_fund_code                  int                              null  ,
 float_lookup_code               int                              null  ,
 oid_code                        int                              null  ,
 dummy_cusip_code                int                              null  ,
 def_bond_code                   int                              null  ,
 def_bond_int_code               int                              null  ,
 call_type_3                     char(2)                          null  ,
 dollar_dividend                 float(16)                        null  ,
 moody_rating                    char(10)                         null  ,
 moody_rating_no                 float(16)                        null  ,
 moody_chg_code                  int                              null  ,
 sp_rating                       char(10)                         null  ,
 sp_rating_no                    float(16)                        null  ,
 sp_chg_code                     int                              null  ,
 fitch_rating                    char(10)                         null  ,
 fitch_rating_no                 float(16)                        null  ,
 fitch_chg_code                  int                              null  ,
 moody_underlying_rating         char(10)                         null  ,
 moody_underlying_rating_no      float(16)                        null  ,
 moody_underlying_chg_code       int                              null  ,
 sp_underlying_rating            char(10)                         null  ,
 sp_underlying_rating_no         float(16)                        null  ,
 sp_underlying_chg_code          int                              null  ,
 fitch_underlying_rating         char(10)                         null  ,
 fitch_underlying_rating_no      float(16)                        null  ,
 fitch_underlying_chg_code       int                              null  ,
 foreign_indicator               char(1)                          null  ,
 isin                            char(12)                         null  ,
 ex_dividend_date                int                              null  ,
 dividend_date                   int                              null  ,
 currency_code                   char(2)                          null  ,
 country_code                    char(3)                          null  ,
 unit_cash_value                 float(16)                        null  ,
 purpose_type_code               char(3)                          null  ,
 purpose_class_code              char(4)                          null  ,
 purpose_sub_class_code          char(4)                          null  ,
 insurance_secondary_primary     char(60)                         null  ,
 insurance_secondary_secondary   char(60)                         null  ,
 amt_ind       char(1)        null  ,
 d360_365_ind     char(1)        null  ,
 fx_tips_factor     float(16)       null
)
go

Create Table DDL sample(TSQL)的更多相关文章

  1. 【原】MyBatis执行DDL:create table,drop table等等

    [前言] 对MyBatis一直停留在仅仅会用的阶段,常用的场景就是通过MyBatis对表数据进行DML(insert, delete, update等)操作,从来没有想过通过MyBatis对数据库 进 ...

  2. CREATE TABLE——数据定义语言 (Data Definition Language, DDL)

    Sql语句分为三大类: 数据定义语言,负责创建,修改,删除表,索引和视图等对象: 数据操作语言,负责数据库中数据的插入,查询,删除等操作: 数据控制语言,用来授予和撤销用户权限. 数据定义语言 (Da ...

  3. hive基本的操作语句(实例简单易懂,create table XX as select XX)

    hive建表语句DML:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Cr ...

  4. insert table 和create table as 区别

    首先,最大的区别是二者属于不同类型的语句,前者是DML语句(数据操作语言,SQL中处理数据等操作统称为数据操纵语言),完成后需要提交才能生效,后者是DDL语句(数据定义语言,用于定义和管理 SQL 数 ...

  5. select into 、 insert into select 、create table as select复制表

    Insert是T-sql中常用语句,Insert INTO table(field1,field2,...)  values(value1,value2,...)这种形式的在应用程序开发中必不可少.但 ...

  6. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

  7. sqlserver不能直接create table as select

    sqlserver不能直接create table as select 在sqlserver 下想复制一张表的,想到oracle下直接create table xxx as select * from ...

  8. mysql 数据库复制表 create table city1 like city;

    -- 只复制表结构 create table city1 like city; INSERT INTO test2 SELECT * FROM test; -- 上面的表必须存在 -- 复制整张表的数 ...

  9. 【SqlServer】empty table and delete table and create table

    1.建表 1 IF object_id (N'表名', N'U') IS NULL CREATE TABLE 表名 ( 2 id INT IDENTITY (1, 1) PRIMARY KEY ,.. ...

随机推荐

  1. Kafka集群在空载情况下Cpu消耗比较高的问题

    线上kafka与storm的空载情况下负载都比较高, kafka达到122%, storm平均负载达到, 20%,  当前是通过Ambari下管理kafka的, a. 先停止s5的kafka进程.b. ...

  2. Android 通过网络打开自己的APP(scheme)

    通过使用手机的浏览器(内部.第三方能够)访问网页,点击一个链接,开始实施自己的应用程序,和传输数据. 第一Mainifest面对文件启动Activity添加过滤器. <activity andr ...

  3. Yii中CDbCriteria常用总结

    Yii的Active Recorder包装了很多. 特别是把SQL中 把where,order,limit,IN/not IN,like等常用短句都包含进CDbCriteria这个类中去,这样整个代码 ...

  4. Java替换字符或十进制数的字符串

    如今,这个项目的需求:将"甲状腺结节 5*3 cm" 更换 "甲状腺结节 * cm". 在一个字符串的数字来替换空白. 码,如以下: public static ...

  5. intellij idea 13&14 插件推荐及快速上手建议 (已更新!)

    原文:intellij idea 13&14 插件推荐及快速上手建议 (已更新!) 早些年 在外企的时候,公司用的是intellij idea ,当时也是从eclipse.MyEclipse转 ...

  6. Hadoop -YARN 应用程序设计概述

    一概述        应用程序是用户编写的处理数据的统称,它从YARN中申请资源完毕自己的计算任务.YARN自身相应用程序类型没有不论什么限制,它能够是处理短类型任务的MapReduce作业,也能够是 ...

  7. APUE学习笔记(2):lseek()练习与文件洞

    对于lseek函数早在大一的C语言课上就有接触,但是几乎没有使用过,只记得是和文件偏移操作相关的 看了APUE上的示例,又使用od工具查看了内容,果然很神奇,很新鲜 figure3.2.c [c] # ...

  8. Objective C多态

    面向对象的封装的三个基本特征是.继承和多态. 包是一组简单的数据结构和定义相关的操作在上面的其合并成一个类,继承1种亲子关系,子类能够拥有父类定的成员变量.属性以及方法. 多态就是指父类中定义的成员变 ...

  9. Android的FrameLayout使用要注意的问题

    帧布局FrameLayout在Android的五大布局中是最简单的布局方式,在需要布局中的控件有重叠的情况下才使用. 今天Shamoo使用FrameLayout的时候,发现布局里面的控件设置layou ...

  10. EF6+MVC4+EasyUI个人日记系统开源共享

    发现在2015年里学习MVC的人越来越多,本人的群成员也越来越多,为了更方便大家学习,在此共享一个个人的小项目. 如下是部分截图: 简单介绍一下本系统的一些相关知识. 1.简单的3层框架,易学易懂 2 ...