September 15, 2005 at 1:46 am
current situation with a single record in a table
col1 col2 col3 col4
A B c Arrival:Jan 13 Departure:Jan 14
I want the output as mentioned below
col1 col2 col3 col4
A B c Arrival:Jan 13
Departure:Jan 14
Regards
sudarshan selvaraja
September 15, 2005 at 4:11 am
I suggest that you use a reporting tool (Access, Crystal etc) to achieve this sort of formatting. What are you going to do with the output?
Regards
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 15, 2005 at 4:32 am
Im writing a stored procedure..i have just given a recorset there may me more than one recordset..
I want to just break the last column and display in two rows(only the last column)..hope u get it
Regards
September 15, 2005 at 6:02 am
I can think of a query that will give you this, but it would depend on the display of the primary key in the table (for sorting - to keep the record pairs together). Would that be acceptable?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 15, 2005 at 7:04 am
yes pls write down the query..even if needed u can change the structure of the table
regards
September 15, 2005 at 7:40 am
This grim-looking piece of code should get you heading in the right direction!
select id, col1, col2, col3, rtrim(left(col4, charindex('Departure',Col4)-1)) [Desc]
from table
union
select id, '', '', '', ltrim(right(col4, len(col4) - charindex('Departure',Col4)+2))
from table
order by id, col1 desc
It does depend on the existence and correct spelling of the word Departure - if this is not always present and correct, there will need to be more refinements made.
Regards
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 15, 2005 at 7:51 am
Thank u so much...yes its wat i expected
regards
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply