「特別な識別子」のテーブルを作成して入力します。たとえば、
create table special_identifiers (
id int identity not null primary key clustered,
key varchar(10) not null unique
);
次に、SELECT でこれらの特別な ID を次のように削除します。
SELECT i.col1, i.col2,
CASE WHEN si.key IS NOT NULL then '' ELSE i.identifier END identifier
FROM Transactions i
LEFT JOIN special_identifiers si on si.key = i.identifier
これは、「xxx」などの ID の任意の場所で LIKE を削除する必要がある場合に、簡単に拡張できます。
LEFT JOIN special_identifiers si on i.identifier LIKE '%' + si.key + '%'
key
柔軟性を高めるために、列自体に % を追加するだけですが。
最後に、単にテーブルを永続化できない場合は、いつでも仮想的に作成できます。
SELECT i.col1, i.col2,
CASE WHEN si.key IS NOT NULL then '' ELSE i.identifier END identifier
FROM Transactions i
LEFT JOIN (select '1114' key UNION ALL
select '1160') si on si.key = i.identifier