Create Table DDL sample(TSQL)

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

上一篇:Mysql主键索引、唯一索引、普通索引、全文索引、组合索引的区别


下一篇:JS中 window的用法