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. Installshield 64位操作系统下拷贝文件,如何重定向到32位的系统文件夹下

    原文:Installshield 64位操作系统下拷贝文件,如何重定向到32位的系统文件夹下 64位操作系统下拷贝文件重定向问题,在在复制代码前加上Disable(WOW64FSREDIRECTION ...

  2. 快速构建Windows 8风格应用17-布局控件

    原文:快速构建Windows 8风格应用17-布局控件 本篇博文主要介绍三种常用的布局控件:Canvas.Grid.StackPanel. Panel类是开发Windows 8 Store应用中一个重 ...

  3. [译]Java 设计模式之单例

    (文章翻译自Java Design Pattern: Singleton) 单例是在Java最经常被用到的设计模式.它通过阻止其他的实例化和修改来用于控制创建对象的数目.这一特性可应用于那些当只有一个 ...

  4. ubuntu12.04 内核编译 记录

    近期学习linux这门课,做实验要编译系统内核,然后..五一没事就捣鼓了一上午,还好成功了,以下就写下过程吧. 注意:以下过程的有些make 这类的命令 可能要获取权限 1.開始时能够查一下自己如今系 ...

  5. jquery 产品查看放大镜组件

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  6. Ubuntu 14.04 字体设置

    ubuntu 14.04消息公布后,我迫不及待地安装和使用.不知道怎么搞的,整个系统彻底改变了字体.有罪,看. 后来.听说文泉驿米黑效果不错.就试了一下,确实还行. 以下是设置方法: 1.安装文泉驿米 ...

  7. NET框架SOA解决方案(集Windows服务、WinForm形式与IIS形式发布)-分布式应用

    NET框架SOA解决方案(集Windows服务.WinForm形式与IIS形式发布)-分布式应用 RDIFramework.NET,基于.NET的快速信息化系统开发.整合框架,给用户和开发者最佳的.N ...

  8. Visual Studio 2013 Use HTTPS (SSL) On Web Application Projects

    公司调试HTTPS接口会用到,原文:http://www.codeproject.com/Tips/766918/Visual-Studio-Use-HTTPS-SSL-On-Web-Applicat ...

  9. C程序设计语言(第二版)习题:第一章

    第一章虽然感觉不像是个习题.但是我还是认真去做,去想,仅此而已! 练习 1-1 Run the "hello, world" program on your system. Exp ...

  10. script —— 终端里的记录器

    当 你在终端或者控制台工作时,你可能想要记录在终端中所做的一切.这些记录可以用来当作史料,保存终端所发生的一切.比如说,你和一些Linux管理员们同 时管理着相同的机器,或者你让某人远程登陆到了你的服 ...