Reputation
5,680
Next tag badge:
62/100 score
9/20 answers
Badges
2 21 53
Newest
 pivot
Impact
~446k people reached

Jan
8
revised books for aspiring DBA
edited tags
Nov
3
awarded  pivot
Nov
2
answered How to pivot without fixed columns in TSQL?
Nov
2
comment How to pivot without fixed columns in TSQL?
It doesn't look like Compartment has set values, meaning that TruckId = 1 has completely different values than TruckId = 2, etc, typically when you want to pivot the column names are usually the same or similar across different ids, this report is going to have a lot of null values because the column headers are all different. What exactly are you trying to do here? It doesn't sound like pivot is what you need. Here's an example of what it would look like if you pivot - sqlfiddle.com/#!3/f24e5/2 and why I'm not sure it's what you want.
Nov
2
comment How to pivot without fixed columns in TSQL?
I also found a dynamic PIVOT example, but I can't seem to make it work in my situation Do you have any of the code you tried to get PIVOT working?
Oct
29
comment SQL80001 - incorrect syntax near ')'
What version of Oracle? Why are you using old syntax with the (+)? Why don't you use JOIN syntax instead?
Oct
1
awarded  Synonymizer
Oct
1
revised Linked servers on SQL Server 2008 R2 through linked tables in MS-Access?
edited tags; edited tags
Sep
21
revised Select distinct values between two values in different field
added 58 characters in body; edited tags
Sep
10
awarded  Enlightened
Sep
10
awarded  Nice Answer
Aug
17
awarded  Nice Answer
Aug
11
awarded  Convention
Aug
10
revised Split after comma into separate row
added 56 characters in body
Aug
3
awarded  Constituent
Jul
27
awarded  Caucus
Jul
7
comment How to do a SELECT inside of a PIVOT
You can't, you have to use dynamic SQL. PIVOT requires that the columns be known when the command is executed. See this question - dba.stackexchange.com/questions/31760/…
Jun
18
revised Compare 4 or more columns values
added 8 characters in body
May
28
comment Parameter Sniffing Question
Can you cut the code down to something that could be posted? Otherwise we'd be guessing.
May
25
awarded  Yearling