SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 insert problem
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

mitasid
Yak Posting Veteran

New Zealand
51 Posts

Posted - 06/14/2006 :  19:23:31  Show Profile
Hi i want to convert rows to columns in my table.
my rows are jan,feb,mar,apr,.....dec
i want to convert them into columns

how shall i do that?????

nosepicker
Constraint Violating Yak Guru

USA
366 Posts

Posted - 06/14/2006 :  20:39:46  Show Profile
Use the CASE statement:

SELECT
CASE WHEN YourColumn = 'jan' THEN ... END AS [jan],
CASE WHEN YourColumn = 'feb' THEN ... END AS [feb],
...
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22765 Posts

Posted - 06/15/2006 :  03:00:48  Show Profile  Send madhivanan a Yahoo! Message
Read about Cross-tab Reports in sql server help file
Also refer
http://weblogs.sqlteam.com/jeffs/archive/2005/05.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000