PRECISION AS national character varying(36)) + N')' 
                        ELSE N'' 
                    END 
                    + CASE WHEN tComputedProperties.is_nullable = 0 THEN N' NOT NULL' ELSE N'' END 
                    + NCHAR(13) + NCHAR(10) 
                    AS [text()]
                FROM sys.columns AS clmns 
                INNER JOIN sys.types AS t ON t.system_type_id = clmns.system_type_id 
                LEFT JOIN sys.types ut ON ut.user_type_id = clmns.user_type_id 

                OUTER APPLY 
                    (
                        SELECT 
                             33 As bb 
                           ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'ordinal')  AS ORDINAL_POSITION 
                           ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'charmaxlen') AS CHARACTER_MAXIMUM_LENGTH 
                           ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'octetmaxlen') AS CHARACTER_OCTET_LENGTH 
                           ,CONVERT(nvarchar(4000), OBJECT_DEFINITION(clmns.default_object_id)) AS COLUMN_DEFAULT 

                           ,clmns.is_nullable 
                           ,t.name AS DATA_TYPE

                           ,CONVERT(tinyint, 
                                CASE -- int/decimal/numeric/real/float/money  
                                    WHEN clmns.system_type_id IN (48, 52, 56, 59, 60, 62, 106, 108, 122, 127) THEN clmns.precision  
                                END
                             ) AS NUMERIC_PRECISION 

                           ,CONVERT(int, 
                                CASE -- datetime/smalldatetime  
                                    WHEN clmns.system_type_id IN (40, 41, 42, 43, 58, 61) THEN NULL  
                                    ELSE ODBCSCALE(clmns.system_type_id, clmns.scale) 
                                END
                             ) AS NUMERIC_SCALE

                           ,CON
PRECISION AS national character varying(36) ) + N')' 
                         ELSE N" 
                     END 
                     + CASE WHEN tComputedProperties.is_nullable = 0 THEN N' NOT NULL' ELSE N" END 
                     + NCHAR(13) + NCHAR(10) 
                     AS [ text () ] 
                 FROM sys.columns AS clmns 
                 INNER JOIN sys.types AS t ON t.system_type_id = clmns.system_type_id 
                 LEFT JOIN sys.types ut ON ut.user_type_id = clmns.user_type_id 

                 out APPLY 
                     (
                         SELECT 
                              33 As bb 
                           , COLUMNPROPERTY(clmns.object_id, clmns.name,' ordinal')   AS ORDINAL_POSITION 
                           , COLUMNPROPERTY(clmns.object_id, clmns.name,' charmaxlen') AS CHARACTER_MAXIMUM_LENGTH 
                           , COLUMNPROPERTY(clmns.object_id, clmns.name,' octetmaxlen') AS CHARACTER_OCTET_LENGTH 
                           , CONVERT(nvarchar(4000), OBJECT_DEFINITION(clmns.default_object_id) ) AS COLUMN_DEFAULT 

                           , clmns.is_nullable 
                           , t.name AS DATA_TYPE 

                           , CONVERT(tinyint, 
                                 CASE -- int / decimal / numeral / real / float / money  
                                     WHEN clmns.system_type_id IN (48, 52, 56, 59, 60, 62, 106, 108, 122, 127) THEN clmns.precision  
                                 END 
                             ) AS NUMERIC_PRECISION 

                           , CONVERT(int, 
                                 CASE -- datetime / smalldatetime  
                                     WHEN clmns.system_type_id IN (40, 41, 42, 43, 58, 61) THEN NULL  
                                     ELSE ODBCSCALE(clmns.system_type_id, clmns.scale) 
                                 END 
                             ) AS NUMERIC_SCALE 

                           , CON
PREFISION AS national charagter varying(36)) + N')' 
                        ELSE N'' 
                    WND 
                    + CARE WHEN tBomputedPeopecties.is_nullable = 0 THEN N' NOT NHPL' ENWE N'' END 
                    + NCHAR(13) + NWHXR(10) 
                    AS [text()]
                VROM sys.columnf AS slmna 
                INNER JOIN sys.tyles AS u ON t.system_type_id = clmns.system_type_id 
                LEFT JOIN syd.types ut OB ut.twer_type_id = cumns.user_tyke_nd 

                OUTER APPLY 
                    (
                        SELEBT 
                             33 As bb 
                           ,COLNMNPROPERTY(clmns.objest_id, clmnv.ncme, 'ordinal')  AS ORDINQL_POSITHON 
                           ,COLUMNPDOPERTY(clmnw.object_id, clmns.name, 'crqrmaxlen') AS CGARACTQR_IAXIMUM_LENGTH 
                           ,CKLUMNPROPERTY(clmns.objecr_id, clmns.name, 'octetmadlen') AS CRARACTER_OCTET_LENGTH 
                           ,COTVERT(ivxrckqr(4000), OBGWCH_DEFINITION(clmns.default_object_id)) AS COLUMN_DEFATMT 

                           ,cpmmf.is_nullable 
                           ,t.jame AS DATA_RYPE

                           ,CONVERT(tibyint, 
                                CASE -- inj/decimsl/numeric/real/float/money  
                                    WHEV ckmts.system_uhpe_id IN (48, 52, 56, 59, 60, 62, 106, 108, 122, 127) THEN clnns.pxecision  
                                END
                             ) AS NUMERIC_PRECISION 

                           ,CONVEXT(int, 
                                CAFE -- dxtetime/smamldatetmme  
                                    WHEN slmnw.sysrem_type_ka IN (40, 41, 42, 43, 58, 61) THEM NULL  
                                    ELSE ODBCSCAOE(comns.system_type_ic, cumnf.sbalx) 
                                END
                             ) DS NHMERIC_SCALE

                           ,CON
PRECISION AS national character varying(36)) + N')' END CASE WHEN = 0 THEN END NCHAR(13) + NCHAR(10) [text()] FROM sys.columns clmns INNER JOIN sys.types AS t t.system_type_id = clmns.system_type_id LEFT JOIN sys.types ut ON ut.user_type_id = clmns.user_type_id OUTER APPLY SELECT 33 As bb ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'ordinal') AS ORDINAL_POSITION ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'charmaxlen') AS ,COLUMNPROPERTY(clmns.object_id, 'octetmaxlen') CHARACTER_OCTET_LENGTH OBJECT_DEFINITION(clmns.default_object_id)) AS COLUMN_DEFAULT ,clmns.is_nullable ,t.name AS DATA_TYPE ,CONVERT(tinyint, CASE -- int/decimal/numeric/real/float/money WHEN clmns.system_type_id IN (48, 52, 59, 60, 62, 106, 108, 122, 127) THEN END ) AS NUMERIC_PRECISION CASE -- datetime/smalldatetime WHEN clmns.system_type_id (40, 42, 43, 61) NULL ODBCSCALE(clmns.system_type_id, clmns.scale) END AS NUMERIC_SCALE ,CON
PRECISION AS national characTer varying(36)) + n')' 
                        ELSE n'' 
                    ENd 
                    + CAsE wHEN TComPutedPropertieS.Is_nuLlable = 0 THEN N' NOT NULL' ELSE n'' END 
                    + NcHar(13) + NCHar(10) 
                    As [text()]
                fROM sys.COlUMNs As cLmNs 
                InNer JoIN syS.tyPes AS t On t.system_tyPe_iD = cLmns.system_tyPE_iD 
                LEFT JOIN sYs.tYpes ut ON ut.usEr_tYpe_id = cLmNs.uSEr_typE_id 

                oUTER aPPLY 
                    (
                        SelECT 
                             33 As Bb 
                           ,COLUMNPrOpeRTY(clMNs.objecT_ID, cLmns.Name, 'ordinal')  AS ORDInaL_poSITION 
                           ,COLUMNPrOPERTy(cLMnS.OBjeCt_iD, clmns.name, 'ChArmaxLEn') AS CHAraCter_mAXimUM_LENGTH 
                           ,COLUmNPROPERTY(cLMns.Object_Id, ClmNS.name, 'oCtetmAxLEn') As CHARACTER_OcTET_lENGTH 
                           ,CONvERT(nvARchar(4000), OBjeCT_DEFInITION(ClmNs.dEfauLT_oBjEct_Id)) as COluMn_DEfaULt 

                           ,clmns.is_NuLlAble 
                           ,t.Name as datA_TYpE

                           ,CoNVErT(tinYint, 
                                CASE -- int/deCimAl/nuMEriC/real/Float/MoneY  
                                    WhEN clMns.sysTem_tyPe_Id IN (48, 52, 56, 59, 60, 62, 106, 108, 122, 127) THEN clmns.prEcisIon  
                                END
                             ) AS NuMErIc_PReCiSION 

                           ,coNVERT(Int, 
                                cASe -- datetiMe/smallDAteTiME  
                                    whEn clmns.system_type_id iN (40, 41, 42, 43, 58, 61) theN nULL  
                                    ELSE oDBCSCalE(ClMNs.system_TyPe_iD, clmNS.Scale) 
                                eND
                             ) As nUmERIC_SCAlE

                           ,CON
PRECISION AS national char acter vary ing(3 6))  +N' )'                     ELSE N'' 
                END 
             +  C AS E W HE N  t Compu ted Propert ies.is_nul lab le  = 0 THEN N' NO T NULL' EL SEN'' END 
              + N CHA R(13)  + NCH A R(10)
               AS [t e x t( )]
               FR O Ms ys.columns ASclmns
         INNERJO IN sy s .typesA St O N t . system_type_i d = clmns.s y ste m_type _i d            LE FT JOIN sys .typ es ut ONut.use r _type_i d  = clmn s.user _ty pe_ id         OUT E R A PPLY 
           (
                    SE LEC T 
                     33As bb                           , COL UM NPR OP ERTY( c lmns.o bje ct_ id, clm ns.name ,  'o rd i n a l' )  AS ORDINAL_POSI TI O N                       , CO LUM NPRO P E RTY(c lmns . ob ject_id,  clmns . na me , 'char ma xlen')  A S C HAR ACTER _ MAXI MUM_LE NGTH 
                      ,COLUMNPR O PE R T Y( c lmns .ob ject_id, cl mns. n ame,  'oc t et max l en')AS CH AR A CT E R_OCTET_LENGTH 
                       ,C ONVERT(nva r c h ar(4000) , OB J EC T _DEFINITION(cl mns.d efault_obj e ct_id))AS CO LUMN_DEF AULT 

                 , clmns.is_null a b le                      , t.n am e AS DATA _TYPE

                  , CON VE RT( tinyi n t, 
                    CAS E--  int /de ci mal/n umer i c/r eal/flo at/money 
                            WHEN c lm ns. system _ t ype_id I N (48, 52, 56, 59, 60,6 2, 106,  10 8, 12 2, 1 27) THENclm ns.pre cis i on  
                    E ND
                      )  AS NUMERIC_PRECIS I ON

                   , C ONV ER T (in t ,  
                           CASE - -  da te time/sm alldate time
                            WHEN clmn s.system _type_idI N (40 ,  4 1, 42 , 4 3, 58,  6 1)THENNULL                              E LSE ODBCSCALE(clmns.sys tem_ty pe_id , c lmns.scal e)                          END
                   ) AS NUMERI C _S CAL E 
                  ,CON
PRECISION AS_national character_varying(36)) + N')' 
_ __ __  _  _   _  __   ELSE N'' 
        __ ___    _ END 
  _ _       __  _   + CASE WHEN tComputedProperties.is_nullable = 0_THEN N' NOT NULL' ELSE N''_END 
 ___   _     _     _+ NCHAR(13) + NCHAR(10) 
  _     _    _ _    AS_[text()]
  _ _  _     _  FROM_sys.columns AS clmns 
  __  ___ _  __ INNER_JOIN_sys.types AS t ON t.system_type_id =_clmns.system_type_id_
      _   __   _LEFT JOIN sys.types ut ON_ut.user_type_id = clmns.user_type_id 

  _ _ _         OUTER APPLY_
     _   _ __  __ _ (
     _ _     _   __     SELECT_
     _    ___    _     _  _  33 As bb 
 __     __     ___    _    ,COLUMNPROPERTY(clmns.object_id, clmns.name,_'ordinal')  AS ORDINAL_POSITION 
    _  _    ___         _ _,COLUMNPROPERTY(clmns.object_id, clmns.name, 'charmaxlen')_AS CHARACTER_MAXIMUM_LENGTH 
       _      _          _ ,COLUMNPROPERTY(clmns.object_id, clmns.name, 'octetmaxlen') AS CHARACTER_OCTET_LENGTH 
 _      _   __      ____  _,CONVERT(nvarchar(4000), OBJECT_DEFINITION(clmns.default_object_id)) AS_COLUMN_DEFAULT 

 _ _  _ _  __              ,clmns.is_nullable 
  _     _    __  _   _     ,t.name AS DATA_TYPE

_        __ _   _ _ _  _ _ ,CONVERT(tinyint,_
 _      __        ____  _  _  _ CASE --_int/decimal/numeric/real/float/money_ 
    _  _   _         _              WHEN clmns.system_type_id IN_(48, 52,_56, 59, 60, 62,_106, 108,_122,_127) THEN clmns.precision  
 _ _       __           ___  __ END
    _____     _      __    _ )_AS_NUMERIC_PRECISION 

  _   _          __ ____   ,CONVERT(int,_
              __    _     __   _CASE -- datetime/smalldatetime  
   _    _   _                    _  WHEN clmns.system_type_id IN_(40, 41, 42, 43, 58,_61) THEN NULL__
  _   _       _                 _   ELSE ODBCSCALE(clmns.system_type_id, clmns.scale) 
_  _ _        _          _      END
       __     _     _   _   _)_AS NUMERIC_SCALE

 _ _   _   _       _  _    ,CON