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. java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory

    java.lang.IllegalAccessError: tried to access field org.slf4j.impl.Static.. java.lang.IllegalAccessE ...

  2. SOA面向服务架构

    SOA面向服务架构 风尘浪子 只要肯努力,梦想总有一天会实现 随笔分类 - SOA面向服务架构 结合领域驱动设计的SOA分布式软件架构 摘要: 领域驱动设计DDD的总体结构,Repository层使用 ...

  3. PHP 生成唯一激活码

    <?php /** * 从来没有产生一个唯一的激活码 * @return string */ function create_guid($namespace = null) { static $ ...

  4. ichartjs 使用BUG,assign_scale:true 解决

    今天纯属灌水,好久没灌水的. 最近使用了flotr2 和 ichartjs进行canvas图标的开发,都不能满足需求. 没办法,先将就用用吧.然后,既然其他大神推荐使用ichartjs,为了统一,我也 ...

  5. Java 多线程之happens-before规则解释

    关于happens-before规则的解释网上有很多,我就不敢班门弄斧了.贴出两篇不错的文章以供学习. 1.happens-before俗解 2.深入Java内存模型--happen-before规则

  6. Web神器WebStorm 8.0测试版发放(慧都独家)

    WebStorm 8.0测试版的发放,标志着WebStorm规划构建的发展成熟. 此次WebStorm 8.0测试版的主要变化是支持高级的AngularJS和集成Spy-js JavaScript跟踪 ...

  7. javascript 正则介绍

    1.正则直接量字符 \o NUL字符(\u000)\t 制表符\n 换行符(\u000A)\v 垂直制表符\f 换页符\xnn 由16进制nn指定的拉丁字符\uXXXX 由16进制XXXX指定的unc ...

  8. SVN服务器搭建(1)

    转自:http://www.cnblogs.com/xiaobaihome/archive/2012/03/20/2407610.html SVN服务器搭建和使用(一) Subversion是优秀的版 ...

  9. php表单(2)

    学习php表单 主要是想知道 前端通过submit之后 后端是如何进行操作的.现在实现一个效果:点击submit,输入框的信息不会被刷掉:刷新页面,输入框的信息被刷掉(index.php). < ...

  10. 【推荐】推荐一本学习ExtJS4的好书《ExtJS江湖》(含pdf电子书和源代码下载地址)

    最近在网上游逛,突然发现了一本介绍ExtJS 4框架的好书,书名叫<ExtJS江湖>,作者是大漠穷秋,个人感觉非常不错,书写得很幽默,很具有可读性,在此推荐给各位. 以下是这本书的介绍: ...