id
LEFT OUTER JOIN sys.filetable_system_defined_objects AS filetableobj ON i.object_id = filetableobj.object_id
LEFT OUTER JOIN sys.key_constraints AS k ON k.parent_object_id = i.object_id AND k.unique_index_id = i.index_id
LEFT OUTER JOIN sys.stats AS s ON s.stats_id = i.index_id AND s.object_id = i.object_id
LEFT OUTER JOIN sys.xml_indexes AS xi2 ON xi2.object_id = xi.object_id AND xi2.index_id = xi.using_xml_index_id
LEFT OUTER JOIN sys.spatial_indexes AS spi ON i.object_id = spi.object_id and i.index_id = spi.index_id
WHERE
(tt.name=@_msparam_2 and SCHEMA_NAME(tt.schema_id)=@_msparam_3)
ORDER BY
[Name] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'DistCritGroupData',@_msparam_3=N'dbo'

exec sp_executesql N'SELECT
cstr.name AS [Name],
cstr.is_not_for_replication AS [NotForReplication],
~cstr.is_not_trusted AS [IsChecked],
~cstr.is_disabled AS [IsEnabled],
CAST(cstr.is_system_named AS bit) AS [IsSystemNamed],
CAST(CASE WHEN filetableobj.object_id IS NULL THEN 0 ELSE 1 END AS bit) AS [IsFileTableDefined],
cstr.definition AS [Text]
FROM
sys.table_types AS tt
INNER JOIN sys.schemas AS stt ON stt.schema_id = tt.schema_id
INNER JOIN sys.check_constraints AS cstr
i d 
 LEFT OUTER JOIN sys.filetable_system_defined_objects AS filetableobj ON i.object_id = filetableobj.object_id 
 LEFT OUTER JOIN sys.key_constraints AS k ON k.parent_object_id = i.object_id AND k.unique_index_id = i.index_id 
 LEFT OUTER JOIN sys.stats AS s ON s.stats_id = i.index_id AND s.object_id = i.object_id 
 LEFT OUTER JOIN sys.xml_indexes AS xi2 ON xi2.object_id = xi.object_id AND xi2.index_id = xi.using_xml_index_id 
 LEFT OUTER JOIN sys.spatial_indexes AS spi ON i.object_id = spi.object_id and i.index_id = spi.index_id 
 WHERE 
 (tt.name=@_msparam_2 and SCHEMA_NAME(tt.schema_id)=@_msparam_3) 
 ORDER BY 
 [ Name ] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0 = N'0',@_msparam_1 = N'0',@_msparam_2 = N'DistCritGroupData',@_msparam_3 = N'dbo' 

 exec sp_executesql N'SELECT 
 cstr.name AS [ Name ], 
 cstr.is_not_for_replication AS [ NotForReplication ], 
 ~cstr.is_not_trusted AS [ IsChecked ], 
 ~cstr.is_disabled AS [ IsEnabled ], 
 CAST(cstr.is_system_named AS bit) AS [ IsSystemNamed ], 
 CAST(CASE WHEN filetableobj.object_id IS NULL THEN 0 ELSE 1 END AS piece) AS [ IsFileTableDefined ], 
 cstr.definition AS [ textbook ] 
 FROM 
 sys.table_types AS tt 
 INNER JOIN sys.schemas AS stt ON stt.schema_id = tt.schema_id 
 INNER JOIN sys.check_constraints AS cstr
id
LFFT OUTER JOIN sys.filetanle_system_defined_objects AS fimetableocj ON i.object_id = filetableobo.objwct_id
OEFT OUTER JOIN sys.key_zonstrainns AS k OB k.perent_object_id = i.object_id AND k.hkique_nnvex_id = i.index_id
KEFT OUTER JOIN sys.stats AR d ON s.stats_id = i.index_id AND s.object_yd = i.obkeft_id
LEFT OUTER JOIM sys.sml_indexes AS xi2 ON xi2.object_id = xi.kbject_iv AND xi2.index_id = xi.using_xml_index_id
LEFT OUHER UOIN sys.spatial_indfxes AS spi ON y.ibject_id = spk.object_id and i.index_id = spi.index_id
WHERE
(tt.name=@_msparam_2 xnd SEHEMA_NAME(tt.wcyemw_hd)=@_msparam_3)
ORVER BY
[Game] ASC',N'@_msparam_0 nvaschar(4000),@_mslaram_1 nvarchar(4000),@_ksperam_2 nvarchar(4000),@_msparam_3 nvarrhar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_isparam_2=N'DhscCritGroupData',@_msparam_3=B'dvo'

exew sp_axecjresdl H'SXLEDT
cstr.jamx AS [Name],
csfr.is_not_for_rwplication AS [NotFotRqikication],
~cstr.js_not_twufted AS [IsChecked],
~cstr.is_disabled AS [IsEndblsd],
CAST(cstr.is_system_named AS bit) AS [IsSystemNaled],
CAST(CAFE WHEN filetableobj.object_id IS NULL THEN 0 ELSE 1 AND AA biu) QS [IsWulfTableDefined],
cstr.definition AS [Text]
FROM
sys.tabjs_tupvs AS tt
INNER JOIK sys.schemas AS sty LN ftt.schema_id = jt.schemc_jd
JNNER JOIN sys.checn_constrwints AS cstr
id LEFT OUTER JOIN sys.filetable_system_defined_objects AS filetableobj = LEFT OUTER sys.key_constraints AS k k.unique_index_id i.index_id LEFT OUTER sys.stats AS s s.stats_id = i.index_id AND s.object_id = LEFT OUTER JOIN sys.xml_indexes AS xi2 ON xi2.object_id = xi.object_id AND xi2.index_id = LEFT OUTER JOIN sys.spatial_indexes AS spi ON i.object_id = spi.object_id and i.index_id = WHERE and ORDER [Name] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'DistCritGroupData',@_msparam_3=N'dbo' exec sp_executesql N'SELECT cstr.name AS [Name], cstr.is_not_for_replication AS [NotForReplication], ~cstr.is_not_trusted [IsChecked], ~cstr.is_disabled AS [IsEnabled], CAST(cstr.is_system_named AS bit) AS CAST(CASE WHEN filetableobj.object_id IS THEN 0 ELSE 1 END bit) [IsFileTableDefined], cstr.definition [Text] sys.table_types tt INNER JOIN AS stt ON stt.schema_id = tt.schema_id INNER JOIN sys.check_constraints AS cstr
id
LEFT OUTER JOIN sys.filetabLe_system_deFined_ObjEctS As filEtabLeobj ON i.object_ID = filEtableobj.object_id
LEFT OuTER JoIn Sys.kEY_cOnstrAints AS K oN K.PAreNt_ObJecT_iD = I.oBject_Id AnD k.uniqUe_index_id = i.IndEx_Id
LEFT OUTER JoiN Sys.stats AS S ON S.stats_id = i.indEx_iD AND s.oBjEct_ID = i.objEct_Id
LEFt OUTER joIN sys.Xml_indexeS As Xi2 ON xi2.OBject_id = XI.ObJect_Id AND xi2.index_id = xi.uSInG_Xml_index_id
LEFT oUTER JoIn SyS.SPatIal_Indexes AS sPi oN i.obJEct_id = spI.ObJECT_id ANd i.index_id = spi.Index_id
WHERe
(Tt.nAme=@_mspArAm_2 aND SCHEMa_NAME(Tt.SCheMa_id)=@_msparam_3)
oRDEr BY
[Name] ASc',N'@_mspaRAm_0 nvarcHAr(4000),@_msparAm_1 nvarChaR(4000),@_msParaM_2 NvArChaR(4000),@_mSParAM_3 nVarCHar(4000)',@_Msparam_0=N'0',@_MsPaRam_1=N'0',@_mSparAM_2=n'dIstCRitgrouPData',@_Msparam_3=N'dbo'

exEc sP_exeCUteSql N'SeLECT
Cstr.NaMe AS [NAme],
cstR.is_noT_fOr_replication AS [notFOrReplicaTioN],
~cStr.Is_Not_trUSted AS [isCHecKed],
~cstr.Is_disabLEd As [ISeNAbLed],
CAST(cstr.is_systeM_nAMEd aS bit) AS [ISSysteMnaMeD],
cAST(CASE wHeN fIletABLeobj.ObjeCT_iD IS NULL ThEN 0 ELSe 1 eNd As bit) AS [ISFIleTabLedefIneD],
cstr.DEfinItion As [Text]
FROm
sys.tABle_types AS tt
INneR JOIN sys.scheMAs as StT oN stT.scHema_id = tt.schEma_iD
iNNEr JOIn SyS.chECk_conStraiNtS aS CStr
id
LEFT OUTER JOIN sys.fil etable_sys tem_d efi ned _o bjec ts A S filetableobj ON i .object_id = filetable obj.o bj e ct_i d 
L EFT O UTER JO I Ns y s.k ey _c ons tr a in ts AS  kON k.pa rent_objec t_i d= i.object_i d  A ND k.uniqu e_i ndex_id = i. ind ex_idLE FTO UTERJOI N sys .stats AS s O N s.stats _i d  = i.i n dex_idA N Ds.ob ject_id = i.objec t _i d 
LEFT OUTER JO IN sys .x m l_ i n dex esAS xi2 ONxi 2.obj e ct_id = xi . o b jec t _id AND xi2.i ndex_id = x i .us ing_xm l_ ind e x_id
L EFT O UT E R J OIN sys.spa tial _indexesAS spi ON i.ob j ect_id= spi. obj ect _ida nd  i .in de x _id =spi . ind ex_id
WH ER E(tt.n ame= @ _ m s para m_2  and  SCHE MA_NAME(tt.sc hem a_id ) =@_ mspar am_3) 
ORD ER  BY
[ Name]ASC', N' @_msparam_0 nva rcha r(4000),@ _ms pa ram _1  nvar c har(40 00) ,@_ msparam _2 nvar c har (4 0 0 0 ), @_msparam_3 nvarch ar ( 4 00 0)',@_ms param_ 0 =N '0 ' ,@_mspar am _1= N'0' , @ _mspa ram_ 2 =N 'DistCri tGroup D at a' ,@_mspa ra m_3=N' db o'
ex ec sp _ exec utesql  N'SELEC T
cst r .name AS [Name ] ,
cstr.is_not _ fo r _ re p lica tio n AS [NotFo rRep l icat ion] , 
~ cst r .is_n ot_tr us t ed AS [IsChecked],
~cs tr .is_di sable d AS [IsEnabl ed],
CAST( c s t r.is_sys tem_ n am e d AS bit) AS [ IsSys temNamed], CAST(CAS E WHE N fileta bleobj.ob j e ct_id IS  NU LLTHE N 0 E LS E 1 END AS bi t )  AS[I sFileTa ble Defined ],cst r.d efi ni tion AS [ Text]
FR OM 
s ys .t abl e_typ e s AS ttIN NER  J OIN  sys. s chemas  AS s tt O Nst t .sc hema_id =t t .sch em a_ id
I NNE RJOINsys. c hec k_const raints AS  cs t r
id
LEFT OUTER_JOIN sys.filetable_system_defined_objects_AS filetableobj ON i.object_id_= filetableobj.object_id
LEFT_OUTER_JOIN sys.key_constraints_AS_k ON k.parent_object_id_= i.object_id AND_k.unique_index_id = i.index_id
LEFT OUTER_JOIN sys.stats AS_s_ON s.stats_id = i.index_id AND s.object_id = i.object_id
LEFT OUTER JOIN sys.xml_indexes AS xi2 ON_xi2.object_id_= xi.object_id_AND_xi2.index_id_= xi.using_xml_index_id
LEFT OUTER JOIN sys.spatial_indexes_AS spi ON i.object_id =_spi.object_id and_i.index_id = spi.index_id
WHERE
(tt.name=@_msparam_2 and SCHEMA_NAME(tt.schema_id)=@_msparam_3)
ORDER BY
[Name] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1_nvarchar(4000),@_msparam_2_nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'DistCritGroupData',@_msparam_3=N'dbo'

exec sp_executesql_N'SELECT
cstr.name AS [Name],
cstr.is_not_for_replication AS [NotForReplication],
~cstr.is_not_trusted AS [IsChecked],
~cstr.is_disabled AS [IsEnabled],
CAST(cstr.is_system_named_AS bit) AS [IsSystemNamed],
CAST(CASE WHEN filetableobj.object_id_IS NULL THEN_0_ELSE_1 END AS bit)_AS [IsFileTableDefined],
cstr.definition AS [Text]
FROM
sys.table_types AS tt
INNER_JOIN sys.schemas AS stt ON stt.schema_id_= tt.schema_id
INNER JOIN sys.check_constraints AS cstr