psingla (6/26/2013)
useif (select TOp 1 UNITE_COUT_MATERIEL from DIM_INTER_MATERIEL)= 'Unité'
or
if exists (select 1 from DIM_INTER_MATERIEL where UNITE_COUT_MATERIEL = 'Unité')
both the above query will work in your case.
sub query should return single value if you are using =operator to compare/assign the result of the query.
you'd want to avoid the top 1 example; without a ORDER BY statement, and if that table has multiple rows, there's no way to know if the randomly selected top row would actually be what you were looking for, unless you KNOW that table only ever has a single row in it.
The EXISTS is my preference, just like you posted here.
Lowell