· 10 years ago · Sep 16, 2016, 10:44 AM
1apples
2pairs
3pomegranites
4
5create table FruitList (FruitName char(30))
6insert into FruitList values ('apples'), ('pears'), ('oranges')
7
8select * from FruitList left outer join AllFruits on AllFruits.fruit = FruitList.FruitName
9where AllFruits.fruit is null
10
11where
12 @FruitListString not like '%|' + fruit + '|%'
13
14if exists(select top 1 name from fruit where name in ('apples', 'pairs', 'pomegranates'))
15 PRINT 'one exists'