July 6, 2018 at 7:01 am
Heslous - Friday, July 6, 2018 6:17 AMHi Thom
i do not see the Jeff's link you talk about
Jeff Moden - Thursday, June 28, 2012 12:48 PMSince there are an unknown number of potential columns, the following article tells you how to do it.http://www.sqlservercentral.com/articles/Crosstab/65048/If you'd like a coded answer, it would be helpful if the data you presented were in a readily consumable format. Please see the first link in my signature line below for how to do that properly.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 9, 2018 at 2:52 am
Thom A - Friday, July 6, 2018 4:49 AMHeslous - Friday, July 6, 2018 4:26 AMHi everyone i have a very request regarding displaying rows in horizontal i want the columns name of a SQL server table displayed horizontally like following My query :
NB AFPO is the name of the table i want to display columns name from
Also, i have a lot of tables to get the columns name displayed in Horizontal so help would be appreciatedMy query:
select column_id, name from sys.all_columns where object_id = OBJECT_ID(N'AFPO') order by column_iddisplays :
column_id name
1 POSNR
2 MANDT
3 AUFNR
4 KDAUFAnd i want this to be displayed this way :
column_id 1 2 3 4
name POSNR MANDT AUFNR KDAUFand no way to find out how to achieve that. Could you help me?
6 year old topic 😉
As for how to do this, have you had a look at the article that Jeff linked above? It should greatly help you get what you're after. Have a read and try yourself; if you get stuck please do post what you've tried so we can help you further.
attahced is something that i created to do exactly that
***The first step is always the hardest *******
July 9, 2018 at 5:28 am
Thom A - Monday, July 9, 2018 3:33 AMSGT_squeequal - Monday, July 9, 2018 2:52 AMattahced is something that i created to do exactly thatYou've not attached anything.
sorry just noticed that .sql was not in the approved list see attached
***The first step is always the hardest *******
July 9, 2018 at 5:42 am
SGT_squeequal - Monday, July 9, 2018 5:28 AMsorry just noticed that .sql was not in the approved list
Probably because you can put SQL straight into your post. People are less inclined to download files from strangers. 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply