Home All Groups Group Topic Archive Search About
Author
8 Sep 2005 5:43 PM
Britney
hi guys,
   how do you transpose a table?  I don't need the actual sql codes, but I
want to know Algorithm and steps and how you would do it.  I went to an
interview and tech guy asked me this question and I don't know how to answer
him, that really bothers me.

Author
8 Sep 2005 5:58 PM
Aaron Bertrand [SQL Server MVP]
http://www.aspfaq.com/2462





Show quote
"Britney" <britneychen_2***@yahoo.com> wrote in message
news:%238HXbzJtFHA.3236@TK2MSFTNGP09.phx.gbl...
> hi guys,
>   how do you transpose a table?  I don't need the actual sql codes, but I
> want to know Algorithm and steps and how you would do it.  I went to an
> interview and tech guy asked me this question and I don't know how to
> answer him, that really bothers me.
>
>
>
>
>
Author
8 Sep 2005 6:09 PM
Britney
what is PIVOT?

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uQSEW7JtFHA.460@TK2MSFTNGP15.phx.gbl...
> http://www.aspfaq.com/2462
>
>
>
>
>
> "Britney" <britneychen_2***@yahoo.com> wrote in message
> news:%238HXbzJtFHA.3236@TK2MSFTNGP09.phx.gbl...
>> hi guys,
>>   how do you transpose a table?  I don't need the actual sql codes, but I
>> want to know Algorithm and steps and how you would do it.  I went to an
>> interview and tech guy asked me this question and I don't know how to
>> answer him, that really bothers me.
>>
>>
>>
>>
>>
>
>
Author
8 Sep 2005 6:40 PM
Aaron Bertrand [SQL Server MVP]
> what is PIVOT?

What is transpose?
Author
8 Sep 2005 7:03 PM
JT
http://dictionary.reference.com/search?q=transpose

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uFWJZSKtFHA.3640@tk2msftngp13.phx.gbl...
>> what is PIVOT?
>
> What is transpose?
>
Author
9 Sep 2005 2:03 PM
Aaron Bertrand [SQL Server MVP]
Thanks, I know the definition of the word transpose.  I figured the article
would have made it at least somewhat clear that pivot is what she is looking
for.  :-(
Author
9 Sep 2005 2:26 PM
JT
Back in the early 90's, I bluffed my way through a lot questions by simply
answering: "Sure, that can be done using a Windows API function call". Of
course, that was the correct answer 99% of time (although probably not the
best answer). For SQL Server, the answer "I would use T-SQL to do that."
works. If the interviewer is not a DBA or database developer, then they
probably won't ask a follow up. Just to cover your ass, you can later go to
BOL and lookup the details.    ;-)

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uqtOscUtFHA.276@TK2MSFTNGP10.phx.gbl...
>> http://dictionary.reference.com/search?q=transpose
>
> Thanks, I know the definition of the word transpose.  I figured the
> article would have made it at least somewhat clear that pivot is what she
> is looking for.  :-(
>
Author
8 Sep 2005 6:52 PM
David Portas
A "pivot" is Microsoft's parlance for a generalization of what's
commonly called a cross-tab report. Pivot is what I would assume you
mean by "transpose". If you meant something different then please
explain.

SQL Server 2005 supports PIVOT directly as a clause in the SELECT
statement. In SQL 2000 however you some standard SQL queries to achieve
the same thing. Try out the examples that Aaron posted - it's easier to
demonstrate it than to describe it.

--
David Portas
SQL Server MVP
--
Author
8 Sep 2005 7:01 PM
AK
>A "pivot" is Microsoft's parlance for a generalization of what's
>commonly called a cross-tab report

not only MSFT's. Google up Jonathan Gennick's article "Turning On Pivot
Tables" on oracle.com

AddThis Social Bookmark Button