Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concat 2 columns with an 'Enter' between them -Help!

Status
Not open for further replies.

aspengal

Technical User
Dec 27, 2004
41
US
Hi Yall, I want to concatenate 2 columns in my select each column in a different line.

This is an example.

Column_A has 'How to create a Service Order'
Column_b has 'Click on the below link to create an SOR'

My Query:
select Column_A+Column_b from tableA

Desired Result
How to create a Service Order
Click on the below link to create an SOR

Current Result
How to create a Service OrderClick on the below link to create an SOR.


 
Add a carriage return and line feed between them.

select @col1 + char(13) + char(10) + @col2
 
select SHORT_DESC+char(13)+char(10)+ LONG_DESC as DESCRIPTION FROM TSTRATA_SEARCH_ENGINE

It does not work. What is the syntax to add a carriage return? Please help!!
 
it worked for me in QA
set the result output to text, in grid mode you will not see it.
 
Thanks a lot. But the problem is I need to display this in my asp grid and I'am unable to do so. Any suggestions? Thanks in advance.
 
Doesn't HTML use <br> to cause the equivalent of carriage return line feed?

select SHORT_DESC+ '<br>' + LONG_DESC as DESCRIPTION FROM TSTRATA_SEARCH_ENGINE



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks George, another problem is I have my SQls in an XML file and the xml wont accept <br>. :(

Thanks for the help!
 
Sorry, but I'm not very familiar with XML. There is an XML forum on tektips.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
So... SQL contains XML containing HTML [spineyes]

You'll probably have to SGML <br> to &lt;br/&gt; or use <![CDATA[ ... ]]> stuff.

What about doing all that thingamajig from ASP? After all, SQL is good for data retrieval & storage, not for formatting.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
THanks ya'll for the response. I looped through my Dataset that has the data from the XML file, then concatenated the two columns using a <br> in my aspx.cs code. It works for now.

Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top