Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Table Folding

4 posts in General Discussion Last posting was on 2003-08-09 18:11:58.0Z
PaulMacCnj Posted on 2003-08-07 19:03:17.0Z
From: "PaulMacCnj" <paul.machiaverna@i-stat.com>
Newsgroups: ianywhere.public.general
Subject: Table Folding
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.162.128.158
X-Original-NNTP-Posting-Host: 65.162.128.158
Message-ID: <3f32a275@forums-1-dub>
Date: 7 Aug 2003 12:03:17 -0700
X-Trace: forums-1-dub 1060282997 65.162.128.158 (7 Aug 2003 12:03:17 -0700)
X-Original-Trace: 7 Aug 2003 12:03:17 -0700, 65.162.128.158
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1544
Article PK: 3774

Just using a SQL statement (no application), is there a way to display a row
of columns a table as a column of rows?

For example, there's a table with columns First, Second and Third. The
desired display is:

First
Second
Third

using a SELECT --- statement.

I found information about the opposite of this, called Pivoting. There was
a brief mentioning of table Folding, but the example wasn't useful in my
case.

Thanks,
Paul


Breck Carter [TeamSybase] Posted on 2003-08-07 20:42:51.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Table Folding
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <v3e5jvkm1mf5jef8ag52ijlh7qunh26ihi@4ax.com>
References: <3f32a275@forums-1-dub>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.82.140.70
X-Original-NNTP-Posting-Host: 65.82.140.70
Date: 7 Aug 2003 13:42:51 -0700
X-Trace: forums-1-dub 1060288971 65.82.140.70 (7 Aug 2003 13:42:51 -0700)
X-Original-Trace: 7 Aug 2003 13:42:51 -0700, 65.82.140.70
Lines: 41
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1546
Article PK: 3776

If you want to send a single row to a text file you could use the
STRING function with CR-LF characters added; e.g.,

UNLOAD
SELECT STRING (
t.c1, '\x0D\x0A',
t.c2, '\x0D\x0A',
... )
FROM t
WHERE t.id = 1
TO 'c:\\temp\\test.txt' ESCAPES OFF QUOTES OFF;

Breck


On 7 Aug 2003 12:03:17 -0700, "PaulMacCnj"

<paul.machiaverna@i-stat.com> wrote:

>Just using a SQL statement (no application), is there a way to display a row
>of columns a table as a column of rows?
>
>For example, there's a table with columns First, Second and Third. The
>desired display is:
>
>First
>Second
>Third
>
>using a SELECT --- statement.
>
>I found information about the opposite of this, called Pivoting. There was
>a brief mentioning of table Folding, but the example wasn't useful in my
>case.
>
>Thanks,
>Paul
>

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com


PaulMacCnj Posted on 2003-08-08 13:21:33.0Z
From: "PaulMacCnj" <paul.machiaverna@i-stat.com>
Newsgroups: ianywhere.public.general
References: <3f32a275@forums-1-dub> <v3e5jvkm1mf5jef8ag52ijlh7qunh26ihi@4ax.com>
Subject: Re: Table Folding
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.162.128.158
X-Original-NNTP-Posting-Host: 65.162.128.158
Message-ID: <3f33a3dd$1@forums-1-dub>
Date: 8 Aug 2003 06:21:33 -0700
X-Trace: forums-1-dub 1060348893 65.162.128.158 (8 Aug 2003 06:21:33 -0700)
X-Original-Trace: 8 Aug 2003 06:21:33 -0700, 65.162.128.158
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1552
Article PK: 3781

Breck,
This is a step in the right direction. However, is there a way to take this
further by dynamically selecting the columns instead of hardcoding them?
That part of the SQL statement could then be an abstract piece of code for
use with any table/columns.

Paul

"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
message news:v3e5jvkm1mf5jef8ag52ijlh7qunh26ihi@4ax.com...
> If you want to send a single row to a text file you could use the
> STRING function with CR-LF characters added; e.g.,
>
> UNLOAD
> SELECT STRING (
> t.c1, '\x0D\x0A',
> t.c2, '\x0D\x0A',
> ... )
> FROM t
> WHERE t.id = 1
> TO 'c:\\temp\\test.txt' ESCAPES OFF QUOTES OFF;
>
> Breck
>
>
> On 7 Aug 2003 12:03:17 -0700, "PaulMacCnj"
> <paul.machiaverna@i-stat.com> wrote:
>
> >Just using a SQL statement (no application), is there a way to display a
row
> >of columns a table as a column of rows?
> >
> >For example, there's a table with columns First, Second and Third. The
> >desired display is:
> >
> >First
> >Second
> >Third
> >
> >using a SELECT --- statement.
> >
> >I found information about the opposite of this, called Pivoting. There
was
> >a brief mentioning of table Folding, but the example wasn't useful in my
> >case.
> >
> >Thanks,
> >Paul
> >
>
> bcarter@risingroad.com
> Mobile and Distributed Enterprise Database Applications
> http://www.risingroad.com


Breck Carter [TeamSybase] Posted on 2003-08-09 18:11:58.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Table Folding
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <5aeajvce5g7ru3tqg7sl47hcntnl2km5ri@4ax.com>
References: <3f32a275@forums-1-dub> <v3e5jvkm1mf5jef8ag52ijlh7qunh26ihi@4ax.com> <3f33a3dd$1@forums-1-dub>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 9 Aug 2003 11:11:58 -0700
X-Trace: forums-1-dub 1060452718 64.7.134.118 (9 Aug 2003 11:11:58 -0700)
X-Original-Trace: 9 Aug 2003 11:11:58 -0700, bcarter.sentex.ca
Lines: 65
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1553
Article PK: 3782

Try EXECUTE IMMEDIATE.

Breck

On 8 Aug 2003 06:21:33 -0700, "PaulMacCnj"

<paul.machiaverna@i-stat.com> wrote:

>Breck,
>This is a step in the right direction. However, is there a way to take this
>further by dynamically selecting the columns instead of hardcoding them?
>That part of the SQL statement could then be an abstract piece of code for
>use with any table/columns.
>
>Paul
>
>"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
>message news:v3e5jvkm1mf5jef8ag52ijlh7qunh26ihi@4ax.com...
>> If you want to send a single row to a text file you could use the
>> STRING function with CR-LF characters added; e.g.,
>>
>> UNLOAD
>> SELECT STRING (
>> t.c1, '\x0D\x0A',
>> t.c2, '\x0D\x0A',
>> ... )
>> FROM t
>> WHERE t.id = 1
>> TO 'c:\\temp\\test.txt' ESCAPES OFF QUOTES OFF;
>>
>> Breck
>>
>>
>> On 7 Aug 2003 12:03:17 -0700, "PaulMacCnj"
>> <paul.machiaverna@i-stat.com> wrote:
>>
>> >Just using a SQL statement (no application), is there a way to display a
>row
>> >of columns a table as a column of rows?
>> >
>> >For example, there's a table with columns First, Second and Third. The
>> >desired display is:
>> >
>> >First
>> >Second
>> >Third
>> >
>> >using a SELECT --- statement.
>> >
>> >I found information about the opposite of this, called Pivoting. There
>was
>> >a brief mentioning of table Folding, but the example wasn't useful in my
>> >case.
>> >
>> >Thanks,
>> >Paul
>> >
>>
>> bcarter@risingroad.com
>> Mobile and Distributed Enterprise Database Applications
>> http://www.risingroad.com
>

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com