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. asp.net中TextBox里面实现回车触发指定事件

    原文:asp.net中TextBox里面实现回车触发指定事件 我在一个user_top用户控件里面做了个包括搜索的功能.然后再一个页面中添加这个用户控件.浏览时候在textbox里面输入搜索内容后.下 ...

  2. android rawquery和query对照

    Cursor cursor = db.rawQuery("select name from *** where id=? ", new String[]{"1" ...

  3. HEAP CORRUPTION DETECTED

    发生主要是由于这个问题给写入超出预分配的空间,注意检查越界情况 版权声明:本文博客原创文章,博客,未经同意,不得转载.

  4. dd命令简单易用,例如

    dd命令简单易用,例如 bs单位,count为写入的范围区间,例如以下举例: 例:使用dd清除vote disk和ocr(裸设备)  $dd if=/dev/zero of=/dev/rrac_ocr ...

  5. 机器学习学习-Types of learning

    Types of learning 基于个人理解.于我们在面对一个详细的问题时.可以依据要达到的目标选择合适的机器学习算法来得到想要的结果.比方,推断一封电子邮件是否是垃圾邮件,就要使用分类(clas ...

  6. javascript图片延迟加载(转载)

    <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...

  7. shell脚本中执行另一个shell脚本

    分类: 可以在一个shell脚本中执行另一个shell脚本(或非可执行文件,主要用于取得一些变量的值),方法是: . 文件名(包括路径) 或 变量=文件名(包括路径) . $变量   注意,圆点后面有 ...

  8. Node填坑教程——简易http服务器

    我们这一期做一个简易的http服务器. 先建一个文件夹,就算是一个空的项目了.然后新建app.js和package.json文件. 这样一个简易项目的基本文件就建好了. 通过命令行工具,在项目路径下输 ...

  9. jae.jd

    免费好用的web应用托管平台   1.前言 曾经很久以前,想找一个免费的空间部署一个属于自己的技术博客真是太难了,使用过SAE,但是很快就面临收费了,后面也就不了了之了.目前自己又找到一个免费的PAA ...

  10. 模板方法(Template)模式

    模板方法(Template)模式 前言 前段时间在亚马逊买了一本<CLR>的书,当时搞活动买一送一,然后挑了一本<漫谈设计模式>,一位不相识的大牛写的,这几天闲来无事,翻了几页 ...