Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Print column names

Author  Topic 

aks
Starting Member

28 Posts

Posted - 2005-03-08 : 15:29:08
Hi,
I want to create new columns as (Jan,Feb,March....) Example

Jan Feb Mar April .....
UID
HRS
I tried CASE .Its working but Is there any other way?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 15:39:12
huh??? a bit more info please... i can't figure out what you're doing inspite all of the ESP

Go with the flow & have fun! Else fight the flow
Go to Top of Page

aks
Starting Member

28 Posts

Posted - 2005-03-08 : 15:44:12
I have a table
UID INT
12 1111
12 1124
12 23
13 1112
13 1124
13 34

Where 1111-jan,1112-feb,1113-march & so on...................
23 & 34 ...r Clients Total Hrs
Now I want the OUTPUT as

UID JAN FEB MARCH APRIl
=========================================================================
12 23
13 34

...................................Hope this will help u.
I tried
case
when int=1111 then output
end as jan
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 15:55:19
that's pivoting.... i think your doing it quite ok.
also try this:
http://www.sqlteam.com/item.asp?ItemID=2955

Go with the flow & have fun! Else fight the flow
Go to Top of Page

aks
Starting Member

28 Posts

Posted - 2005-03-08 : 16:07:18
but I also want to ADD TOTAL HR for each client
UID JAN FEB MARCH APRIL TOTAL ===============================================================================
12 8 32 40
13 6 10 16
Go to Top of Page
   

- Advertisement -