1

I have a table that, among its columns, has two particular char columns: "Code" and "Obs".

For example:

Column1 Code Obs
aaa 123 This customer's code is 123

How do I find this record, based on the fact that the info on column "Code" is present in the info on column "Obs"?

2 Answers 2

1

One option is to use charindex:

SELECT *
FROM   mytable
WHERE  CHARINDEX(code, obs) > 0
Sign up to request clarification or add additional context in comments.

Comments

0

Is there a reason this is happening?

SELECT num1, num2, CHARINDEX(num1, num2) as charindex
FROM   mytable
Num1 Num2 charindex
3456 123-456 0
3579 135790 0
35 35 1
35 351 0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.