December 28, 2018 at 11:33 am
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?
December 28, 2018 at 11:43 am
wendy elizabeth - Friday, December 28, 2018 11:33 AMI 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?
As usual, please provide sample DDL, INSERTs for sample data and desired results.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
December 28, 2018 at 11:43 am
Please don't post duplicate posts on the same topic. You already have a thread on this topic.
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply