Advertisement

01.17.2006 at 12:31AM PST, ID: 21699090
[x]
Attachment Details

Lookup a table sideways with row names.  Is there another way?

Asked by Coolhand2120 in MS SQL Server

Tags: , ,

I have a function that reads thru an array that looks like the first array below in order to look for each input name on a ASP form.  The question is, is there a better way than the bulky crap below to select a table with it's column names in this format.

Thanks!

-Coolhand2120

Example of desired output (array 2D comma and crlf delemeted):
ContactID,{D31CCA6F-0A2B-44B2-AD45-F3B2B713AE52}
FirstName,Bob
LastName,Rogers
Addresss,12345 E 4th St.
etc...

Rather than (what you'd get with getrows())
{D31CCA6F-0A2B-44B2-AD45-F3B2B713AE52},0
Bob,0
Rogers,0
12345 E 4th St.,0

Bulky thing I'm using now

ALTER  PROCEDURE contactArray (@contactID as uniqueidentifier)
AS
select 'ContactID', (select contactID from contacts where contactID = @contactID)
union all
select 'FirstName',(select FirstName from contacts where contactID = @contactID)
union all
select 'LastName',(select LastName from contacts where contactID = @contactID)
union all
select 'Address1',(select Address1 from contacts where contactID = @contactID)
union all
select 'Address2',(select Address1 from contacts where contactID = @contactID)
union all
select 'City',(select City from contacts where contactID = @contactID)
union all
select 'State',(select State from contacts where contactID = @contactID)
union all
select 'ZIP',(select ZIP from contacts where contactID = @contactID)
union all
select 'Country',(select Country from contacts where contactID = @contactID)
union all
select 'HomePhone',(select HomePhone from contacts where contactID = @contactID)
union all
select 'WorkPhone',(select WorkPhone from contacts where contactID = @contactID)
union all
select 'Email',(select Email from contacts where contactID = @contactID)
union all
select 'SpecialInstructions',(select SpecialInstructions from contacts where contactID = @contactID)
union all
select 'Comments',(select Comments from contacts where contactID = @contactID)
Start Free Trial
 
Loading Advertisement...
 
[+][-]01.17.2006 at 01:19AM PST, ID: 15718035

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.17.2006 at 02:00AM PST, ID: 15718218

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.18.2006 at 03:57AM PST, ID: 15727741

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2006 at 10:52PM PST, ID: 15736765

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.19.2006 at 12:31AM PST, ID: 15737085

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.19.2006 at 05:04PM PST, ID: 15745285

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.19.2006 at 05:24PM PST, ID: 15745425

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.20.2006 at 12:37AM PST, ID: 15747280

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: sideways, table, contact
Sign Up Now!
Solution Provided By: nmcdermaid
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.18.2006 at 09:52AM PST, ID: 16225521

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03.18.2006 at 12:12PM PST, ID: 16226252

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32