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 |
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2011-04-20 : 06:27:49
|
| Hey I was wondering if I can join i.e 6-7 Varchar Columns together in a select query so they basically build up 1 big varchar query ?I am doing this for a search I am building |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-04-20 : 06:32:57
|
| join or concatinate ??If concatinate, SELECT col1+' '+ col2+ ' 'col3--------------------------http://connectsql.blogspot.com/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-04-20 : 06:42:00
|
if you have null value in the column use ISNULL() on it before concatenateSELECT isnull(col1, '') + isnull(col2, '') + . . . KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-04-20 : 06:47:17
|
| thanx khtan for correction--------------------------http://connectsql.blogspot.com/ |
 |
|
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2011-04-20 : 10:46:01
|
| Great thanks this works fine i,eselect r.inkexID,isnull(nameCompSecretary, '') + ' ' + isnull(overviewIntroText, '') + ' ' + isnull(History, '') + ' ' + isnull(NameCompChairman, '') + ' ' + isnull(NameCurrCEO, '') as bodyContentFROM organisationRegulatory as r INNER JOIN organisationVoluntary as v ON r.inkexID = v.inkexID where v.publishStatusID = 1Now there is another Value I want to add to this bodyContent in my select, but its a concatenatation from another tableI.e the table is called businessName with structure i.eid inkexID nameAn 1 inkexID can have multiple Names, and I want to basically loop through this table get all name values for an inkexID and then add this string to bodyContent above |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|
|