I have the following table in MS SQL Server:
Value CustomerName Date
-------------------------------------------------------------------
1 Sam[Sammy] 2016-09-30 11:13:15.550
2 Rimi 2016-09-30 11:13:15.550
I am running the following query to fetch the data:
SELECT *
FROM Table
WHERE CONVERT(varchar, convert(date,BillDate), 112) = '20160930' AND
CustomerName LIKE isnull(NULL,CustomerName)
We have a Customer search form that has a Date field and a Customer Name field.The user has the option to search using the customer name but that's optional.
The above query is used to search for the customers using the Date field only. Now, when we run the query to search for customers it does not come up with the expected result. The CustomerName having the box brackets '[]' in their names are missing.
We cannot remove the box brackets in the names.
Is there a way to sort out this problem ?