This query returns the following:
select *
from dbo.persons
where LastName like '%Dan%';
Results:
How can I select only the first row with LastName = "Dan"
and not "Dant" or "Dan12" ?
I am using the following query:
select *
from dbo.persons
where LastName like '%[^a-z]Dan[^a-z]%'
or LastName like 'Dan[^a-z]%'
or LastName like '%[^a-z]Dan'
which returns the following:
LastName = Dan12
LastName = pine and Dan and apple
I want only these results:
LastName = Dan
LastName = pine and Dan and apple
I tried the following query but it returned nothing:
select *
from dbo.persons
where LastName like '%[^a-z][^0-9]Dan[^a-z][^0-9]%'
or LastName like 'Dan[^a-z][^0-9]%'
or LastName like '%[^a-z][^0-9]Dan'