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)
 Col as Row? How?

Author  Topic 

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2005-06-20 : 01:17:11
I had data like this...


a b c d ...
--------------------------
1 2 3 4 ...
AA BB CC DD ...


CREATE TABLE [dbo].[Table11] (
[a] [varchar] (50)
, [b] [varchar] (50)
, [c] [varchar] (50)
, [d] [varchar] (50)
) ON [PRIMARY]
GO

INSERT INTO Table11
SELECT * FROM (
SELECT '1' as a, '2' as b, '3' as c, '4' as d
UNION all
SELECT 'AA', 'BB', 'CC', 'DD'
) AS tempDB

select * from Table11
drop table Table11




I want this kind of result.

a b
---------------
1 AA
2 BB
3 CC
4 DD
... ...


How? tnx

Want Philippines to become 1st World COuntry? Go for World War 3...

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-20 : 01:52:29
Refer this
http://sqlteam.com/item.asp?ItemID=2955

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2005-06-20 : 02:05:03
TNX. madhivanan


How about col to row?

Want Philippines to become 1st World COuntry? Go for World War 3...
Go to Top of Page
   

- Advertisement -