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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 concatinating column with %

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-03-08 : 16:02:46
Hello there

how do i concatinate a column with % when using the like clause


for eg

select * from test inner join individual ind1
on test.[last name] = ind1.surname
where test.[first name] = ind1.forenames
or ind1.forenames like ind1.forenames +'[ ]%'order by test.[first name]



MCTS / MCITP certified

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-03-08 : 16:50:26
Is % in the actual data? Or are you just wanting to attach % as the wildcard?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-08 : 17:19:31
[code]ind1.forenames like ind1.forenames + '%' [/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-03-09 : 08:29:19
It ok i have sorted it.

I wanted to catch first names that also had a second name.

so i used ( where ind1.forenames like t1.[first name] + '%' )
Go to Top of Page
   

- Advertisement -