I want to see if part of the field called teacherD equals the value in the field called lastname .
This is a sql server 2012 database.
Here is the sql
select * from test.dbo.table1
where substring(lastName,isnull(CHARINDEX(lower(lastName),lower([teacherD]) ),0),isnull(LEN(lastName),0) ) like '%lastName%'
The problem with this sql is the like statement listed here can not have wild card characters surrounding a database column as listed above.
This can you show me the sql to replace the like statement listed above or whatever you think the solution should be?