0

I Have a string below

100Pipers22WoodfieldRoadBlackpoolFY16AX

I also have an address table on where i want to cross reference the postcode column to see if the value exists in the above string. Column value would be FY16AX which is visible in the string.

I cant seem to get a match.

1
  • 2
    Tag your question with the database you are using. Also, provide the code you have. Commented Nov 20, 2018 at 12:08

2 Answers 2

1

If I understand correctly, you can use like. In standard SQL, this would look like:

where string like '%' || postcode

The || is the string concatenation operator. Some databases have their own operators or functions for this functionality.

Sign up to request clarification or add additional context in comments.

2 Comments

Might want to consider case too - e.g. UPPER or LOWER on both your string and search-term (in this case postcode)
@doublesidedstickytape, better to use a case insensitive collation.
0
Declare @vString nvarchar(50)
Set @vString = '100Pipers22WoodfieldRoadBlackpoolFY16AX'

Select Count(*) From tbl_Address Where Zip = right(@vString,6)

If the select statement returns a value greater than zero, you have a match.

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.