Reputation: 31
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.
Upvotes: 0
Views: 453
Reputation: 1051
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.
Upvotes: 0
Reputation: 1269623
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.
Upvotes: 1