35%macro mp_getconstraints(lib=WORK
37 ,outds=mp_getconstraints
41%let lib=%upcase(&lib);
47%
if %sysfunc(exist(sashelp.vcncolu,view))=0 %then %
do;
52 ,constraint_type
char(8) label=
'Constraint Type'
53 ,constraint_name
char(32) label=
'Constraint Name'
54 ,column_name
char(32) label=
'Column'
65%let vw=%mf_getuniquename(prefix=mp_getconstraints_vw_);
68 where table_catalog=
"&lib";
74 if tmp ne catx(
'|',table_catalog,table_name,constraint_name) then
do;
77 else constraint_order+1;
78 tmp=catx(
'|',table_catalog, table_name,constraint_name);
84 select upcase(a.TABLE_CATALOG) as libref
85 ,upcase(a.TABLE_NAME) as TABLE_NAME
90 from dictionary.TABLE_CONSTRAINTS a
92 on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
93 and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
94 and a.constraint_name=b.constraint_name
102 where a.TABLE_CATALOG=
"&lib"
103 %if
"&ds" ne
"" %then %do;
104 and upcase(a.TABLE_NAME)=
"&ds"
105 and upcase(b.TABLE_NAME)=
"&ds"
107 order by libref, table_name, constraint_name, constraint_order
116%mend mp_getconstraints;