1

私は次のようなものを持っています -

IF EXISTS (SELECT 1 FROM systable st
                JOIN sysuserperm sup ON st.creator = sup.user_id
                WHERE sup.user_name = 'TEST'
                AND st.table_type = 'BASE'
                AND st.table_name = 'Table1') THEN
IF EXISTS (SELECT 1 FROM systable st
                JOIN sysuserperm sup ON st.creator = sup.user_id
                WHERE sup.user_name = 'TEST'
                AND st.table_type = 'BASE'
                AND st.table_name = 'Table2') THEN

これらの複数を単一の存在に組み合わせる最良の方法は何ですか?

4

3 に答える 3

0

行数が多いほど高速になります。

IF EXISTS (SELECT TOP 1 1 FROM systable st
                JOIN sysuserperm sup ON st.creator = sup.user_id
                WHERE sup.user_name = 'TEST'
                AND st.table_type = 'BASE'
                AND st.table_name in ('Table1', 'Table2')) THEN
于 2013-09-20T20:14:09.233 に答える