ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
how to change column into row in sql
 Question Submitted By :: Tamilvanan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to change column into row in sql
Answer
# 1
With the help of pivot table in sql server 2005 we can do so
 
Is This Answer Correct ?    14 Yes 4 No
Kapil
 
  Re: how to change column into row in sql
Answer
# 2
I agree with this answer..and also we can do the pivot 
transaformation in SSIS.
 
Is This Answer Correct ?    0 Yes 4 No
Sai
 
 
 
  Re: how to change column into row in sql
Answer
# 3
creating pivot table:
Columns as Rows

below statement will give as it is data

select
    PS.Name, P.Color, PIn.Quantity
  from Production.Product P
  inner join Production.ProductSubcategory PS
    on PS.ProductSubcategoryID = P.ProductSubcategoryID
  left join Production.ProductInventory PIn
    on P.ProductID = PIn.ProductID
This statement will change the columns as rows

select
  *
from
(
  select
    PS.Name, P.Color, PIn.Quantity
  from Production.Product P
  inner join Production.ProductSubcategory PS
    on PS.ProductSubcategoryID = P.ProductSubcategoryID
  left join Production.ProductInventory PIn
    on P.ProductID = PIn.ProductID
) DataTable
PIVOT
(
  SUM(Quantity)
  FOR Color
  IN (
    [Black],[Blue],[Grey],[Multi],[Red],
    [Silver],[Silver/Black],[White],[Yellow]
  )
) PivotTable
 
Is This Answer Correct ?    0 Yes 3 No
Samba Shiva Reddy . M
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is SQL server agent? SAP-Labs2
why SQL server is more used to store database rather than Access  2
How will u find the query which is running in some other machine IBM4
Is it possible to have more then one foreign key in a single table? if possible, is this the good way to design the table?  2
1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will happen while we querying on view ? will give any error ? 3. Difference between DROP, DELETE, TRUNCATE table ? 4. What is constraints and types ? 5. What is max size of nchar & nvarchar ? 6. Define ROLLBACK, COMMIT, SAVE POINT 7. How non-clustered better ? or rank the Clustered, Non-Clustered and Table scan in performance wise 8. Select 10 rows from a table ? 9. Define DML, DDL, DCL, DTL commands ? 10. What is mean by NULL value ? NULL means "" or 0 or undefined ? 11. Default constraints ? 12. Can we have more then primary Key in table ? 13. Type of integrity ? Entity, Referential, Domain ? Perot-Systems8
how to write the query to select the rows are in the order of either 1,3,5,7... or 2,4,6,8,... ADP5
where do you use Isolations?give me some exmpale?  1
what are default? Is there a column to which a default cant be bound?  1
how to rename the table  3
An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest salaries(there are 4-5 people having the same salary which happens to be the highest). ADP8
how to connect sybase to sql server 2005?. ABC1
select name of emplyoee whose total salary is 130 from following table. id name salary 1 a 100 2 b 20 3 c 50 1 a 30 2 b 70 Post the resulantant Query?  4
What does it mean to have quoted_identifier on? What are the implications of having it off?  2
I have a huge amount of data which is displayed in a report. The data is viewed every day. Every day the data is displayed in 30 secs but suddenly today it is giving an timeout message today. Data has not been changed. The situation is same as yesterday. What might be the reason??? Please Answer. Satyam4
What is the order in which the SQL query is executed? list them in order. CTS4
What is SQL Profiler what is the use of it? 247Customer2
What is a view?  6
Please tell me some knowledge about Clustering and how to add clustering?  1
what is physical sort data and logical sort data in index?  2
Whether the updations made to the views reflect the original records in the table NIIT5
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2009  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com