On Jan 30, 3:24=A0pm, tijgertje <griet.schauw...@[EMAIL PROTECTED]
> 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 :
>
> @[EMAIL PROTECTED]
=3D 'select columnA, columnB, columnC,.... into #t from.....'
> execute(@[EMAIL PROTECTED]
)
> 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]


|