Split Dual Delimited Strings in TSQL
Posted on 2007-07-23
I have two table columns each containing delimited strings. One of them is called LOCAL_PRIMARY_KEYS, and the other is called EXTERNAL_PRIMARY_KEYS.
LOCAL_PRIMARY_KEYS contains: 'Last_Name,First_Name,Birthdate'
EXTERNAL_PRIMARY_KEYS contains: 'LST_NM,FRST_NM,BDATE'
What I want to produce is a string that looks like this:
WHERE Last_Name = LST_NM AND
First_Name = FRST_NM AND
Birthdate = BDATE
How do I do this using only TSQL? I am using SQL Server 2005.
Thanks in advance.