Re: Select into problem
- From: Manish Negandhi <negandhi.manish@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 03:01:27 -0800 (PST)
On Jan 30, 3:24 pm, tijgertje <griet.schauw...@xxxxxxxxx> wrote:
Hi,
I have a problem concerning the select into statement.
I have created a procedure that contains dynamic sql, which creates a
variable number of columns.
The sql looks like :
@sql = 'select columnA, columnB, columnC,.... into #t from.....'
execute(@sql)
select * from #t
#t is nowhere defined as I cannot predict the number of columns nor
their data types.
The first time I launch the procedure it gives correct results.
However if i launch the procedure again with different arguments
( creating more, or less columns with different column names ) the
definition of #t does not change.
Do you rename or drop the #t table explicitly within the proc ? . You
might want to have a look at section
"Creating a table with a variable number of columns" under Rob's
site, there is stored proc written for the same purpose
http://www.sypron.nl/dynsql.html
-HTH
Manish Negandhi
[TeamSybase Intern]
.
- Follow-Ups:
- Re: Select into problem
- From: tijgertje
- Re: Select into problem
- References:
- Select into problem
- From: tijgertje
- Select into problem
- Prev by Date: Select into problem
- Next by Date: Re: Select into problem
- Previous by thread: Select into problem
- Next by thread: Re: Select into problem
- Index(es):
Relevant Pages
|
|