Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tshaw20832
Starting Member
10 Posts |
Posted - 2014-05-08 : 18:12:33
|
All I forgot a bit of information.I have two columns with the following: Column A Column Baaa-12345-er45-y1 12345www-12344-er56-p1 12344How would I compare the two and get a yes that information in column B contains values in Column A |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-05-08 : 18:24:13
|
select case when columnA like '%' + columnB + '%' then 'yes' else 'no' endfrom yourTableTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-05-09 : 05:45:38
|
or thisselect PATINDEX('%' + columnB + '%',ColumnA) > 0 then 'yes' else 'no' endfrom yourTable ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
tshaw20832
Starting Member
10 Posts |
Posted - 2014-05-09 : 07:56:10
|
Thank you very much everyone. TGIF |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|