Contains and Like does not work with my variable.
I tried using the keywords LIKE
and CONTAINS
@ItemSupplied nvarchar (50)
as
begin
set nocount on;
SELECT [Name]
FROM Suppliers
where CONTAINS(ItemSupplied, @ItemSupplied)
order by [Name];
end
I also tried
@ItemSupplied nvarchar (50)
as
begin
set nocount on;
SELECT [Name]
FROM Suppliers
where ItemSupplied LIKE @ItemSupplied
order by [Name];
end
I want too get the name of suppliers who supply a specific item even though they supply other items as well.
just tested this in MSSQL
DECLARE @ItemSupplied nvarchar (50)
SELECT [Name]
FROM Suppliers
WHERE ItemSupplied LIKE '%' + LTRIM(RTRIM(@ItemSupplied)) + '%'
ORDER BY [Name];