34%macro mp_getconstraints(lib=WORK
36 ,outds=mp_getconstraints
40%let lib=%upcase(&lib);
46%
if %sysfunc(exist(sashelp.vcncolu,view))=0 %then %
do;
51 ,constraint_type
char(8) label=
'Constraint Type'
52 ,constraint_name
char(32) label=
'Constraint Name'
53 ,column_name
char(32) label=
'Column'
64%let vw=%mf_getuniquename(prefix=mp_getconstraints_vw_);
67 where table_catalog=
"&lib";
73 if tmp ne catx(
'|',table_catalog,table_name,constraint_name) then
do;
76 else constraint_order+1;
77 tmp=catx(
'|',table_catalog, table_name,constraint_name);
83 select upcase(a.TABLE_CATALOG) as libref
84 ,upcase(a.TABLE_NAME) as TABLE_NAME
89 from dictionary.TABLE_CONSTRAINTS a
91 on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
92 and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
93 and a.constraint_name=b.constraint_name
101 where a.TABLE_CATALOG=
"&lib"
102 %if
"&ds" ne
"" %then %do;
103 and upcase(a.TABLE_NAME)=
"&ds"
104 and upcase(b.TABLE_NAME)=
"&ds"
106 order by libref, table_name, constraint_name, constraint_order
115%mend mp_getconstraints;