all groups > sql server programming > november 2007 >
You're in the

sql server programming

group:

Column Names as Data


Column Names as Data Andy in S. Jersey
11/2/2007 3:19:20 PM
sql server programming:
I have a table, with data:

CREATE TABLE [dbo].[tblPivot2](
[ref] [varchar](15) NOT NULL,
[Age] [smallint] NULL,
[Zip_Abbrev] [varchar](3) NULL,
[Onset_Age] [smallint] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

INSERT INTO [tblPivot]
([ref]
,[Age]
,[Zip_Abbrev]
,[Onset_Age])
VALUES
('ND12988', 52, '452', 52)

The result of

select * from tblPivot

is:

ref Age Zip_Abbrev Onset_Age
ND12988 52 452 52

I want to query tblPivot and get the following as my result

column_name column_value
ref ND12988
Age 52
Zip_Abbrev 452
Onset_Age 52

Thanks in Advance,

Re: Column Names as Data David Portas
11/2/2007 11:11:03 PM
"Andy in S. Jersey" <AndyinSJersey@discussions.microsoft.com> wrote in
message news:55746EBB-C148-4CC7-A767-79DF6C5478A6@microsoft.com...
[quoted text, click to view]

It seems like this is just a matter of presentation rather than a query. SQL
Server has no control over how you display rows on the screen because your
application or reporting tool takes care of that. Any reporting tool can
give the output you asked for.

--
David Portas

AddThis Social Bookmark Button