Greetings,
I'm looking for a SQL Server statement to retrieve records Where myfield content giving sub-string.
Thank you,
Greetings,
I'm looking for a SQL Server statement to retrieve records Where myfield content giving sub-string.
Thank you,
You can use CharIndex
Select * From YourTable
Where
CharIndex('yoursubstring', myfield) > 0
Try PatIndex.
SELECT *
FROM Table
WHERE patindex('%string%', data ) > 0
select * from mytable where myfield like '%literalstring%'
or
select * from mytable where myfield like '%' + @stringvar + '%'
...not really clear on whether your substring is a literal or a variable
Another possibility is to use LIKE:
SELECT
MT.column_1,
....
FROM
My_Table MT
WHERE
some_column LIKE '%' + @search_string + '%'