delete from T_SEARCH_TABLES
where TABLE_NAME = 'D_VENDOR'
and SEARCH_ID in(select distinct htvf.Value
from T_RESX_VALUES
cross apply dbo.func_split(T_RESX_VALUES.[key],'.') as htvf
where T_RESX_VALUES.value like '%Invoices - Activity (%'
and htvf.Position = '2'
and T_RESX_VALUES.[KEY] like 'SearchName.%'
)
and SEARCH_TABLE_ID not in(select SEARCH_TABLE_ID
from T_SEARCH_COLUMNS
);
Is giving error:
Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value 'SearchName' to data type int.
But
select *
from T_SEARCH_TABLES
where TABLE_NAME = 'D_VENDOR'
and SEARCH_ID in(select distinct htvf.Value
from T_RESX_VALUES
cross apply dbo.func_split(T_RESX_VALUES.[key],'.') as htvf
where T_RESX_VALUES.value like '%Invoices - Activity (%'
and htvf.Position = '2'
and T_RESX_VALUES.[KEY] like 'SearchName.%'
)
and SEARCH_TABLE_ID not in(select SEARCH_TABLE_ID
from T_SEARCH_COLUMNS
);
is working fine what is the problem in it ?
selectversion if you uncomment out the lastnot incondition so your queries are actually searching for the same thing?