I want to get a list of records from a SQL database using LIKE with % before and after the search term. I'm using the github.com/denisenkom/go-mssqldb package. My query is as follows currently:
row, err := DB.Query("SELECT * FROM Person WHERE Name LIKE %@p1%", nameToSearch)
This throws the error: Incorrect syntax near '@p1'.
I've tried other variations of the query including the following:
SELECT * FROM Person WHERE Name LIKE '%%' @p1 '%%'SELECT * FROM Person WHERE Name LIKE '%%' || @p1 || '%%'These fail as well.
Is the driver I'm using not able to support Like's with wildcards?