I am hoping this isn\'t a repeat. I\'ve checked the searches and I can\'t seem to find a clear answer to this.
I have a table that has it\'s primary key set to be a
Do you know that the =
is always there and always is a UNIQUEIDENTIFIER
. Then you can do this:
WHERE CAST(SUBSTRING(URL, CHARINDEX('=',URL)+1,LEN(URL)) AS UNIQUEIDENTIFIER)=StateID
EDIT
As part of the comment you can also so it with a JOIN
. Like this:
select
u.*
from
urltable
join statetable s
on CAST(SUBSTRING(URL, CHARINDEX('=',URL)+1,LEN(URL)) AS UNIQUEIDENTIFIER)=StateID