Hi, I am new to sql and testing a small project so I can understand how the paramater using "like" in the WHERE clause works.
Here are the values from @NewID parameter: B001NEW,C002NEW,C003NEW,C004NEW,C005NEW,C006NEW,C007NEW, and so on.
@NewID is pulling from a field called "InventoryPart" and the data type is nvarchar(7).
"InventoryPart" has 768 total distinct records.
Here is my SELECT statement:
DECLARE @NewID NVARCHAR(7)
SET @NewID = '035'
SELECT WarehouseID as Warehouse, WarehousePhone as Phone, SUBSTRING(InventoryPart, 2, 4) as Part, Price
WHERE SUBSTRING(InventoryPart,2,4) like (@NewID)
ORDER BY SUBSTRING(InventoryPart, 2, 4)
Currently, this query wont execute because of the SUBSTRING(InventoryPart,2,4) like (@NewID) in my where clause.
So, here are my questions:
How do update above query so it will run with single value parameter and multiple parameter and all parameter?
Anyone can help me?