April 16, 2007 at 8:38 am
Hi
I need to join two tables having one filed comman but the one field has perfix server name
So One table has Loginname and other has username user name is combination of servername_loginname. I want to join both tables with these two fields. I have different servername with different string length the only thing comman i have _ between server name and login name.
Any help please ...
Regards
April 16, 2007 at 8:55 am
select ...
from table1 T1
inner join table2 T2
on T2.servername_loginname like '%' + T1.Loginname
or
select ...
from table1 T1
inner join table2 T2
on substring(T2.servername_loginname, charindex('_',T2.servername_loginname) + 1, len(T2.servername_loginname) = T1.Loginname
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply