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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-17 : 10:02:21
|
| Abrahim writes "Hi all, On MS SQL server 2000 I have the following SQL query that I like to view the out put in horizontal format: Select Id, Fisrt_name, Last_name from ABC Instead of getting out-put like Id Fisrt_name Last_name1 Jim Smith2 Tom Jones I like to see the out-put like: Id 1 2First_name Jim TOMLast_name Smith Jones Please advice. Thanks in advance," |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-18 : 00:51:06
|
| [code]Declare @s nvarchar(1000)Select @s=coalesce(@s+' '+convert(varchar(12),id),convert(varchar(12),id)) from Table Select @sset @s=nullSelect @s=coalesce(@s+' '+convert(varchar(12),First_Name),convert(varchar(12),First_Name)) from Table Select @sset @s=nullSelect @s=coalesce(@s+' '+convert(varchar(12),Last_Name),convert(varchar(12),Last_Name)) from Table Select @s[/code]Madhivanan |
 |
|
|
|
|
|